do_action( ‘shutdown’ )

Fires just before PHP shuts down execution.

More Information

Runs just before PHP shuts down execution.

This hook is called by shutdown_action_hook() and registered with PHP as a shutdown function by register_shutdown_function() in wp-settings.php.


do_action( 'shutdown' );



User Contributed Notes

  1. Skip to note 2 content

    The shutdown action is always called, even on fatal errors, Ajax requests, and when using exit; or die(); to terminate a running request.

    That makes this function perfect for a “catch-all” logic, like writing a log file.

    Note: If you call exit; inside your shutdown action-handler, the request will be instantly halted without calling other shutdown action-handlers.

You must log in before being able to contribute a note or feedback.