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.

Top ↑


File: wp-includes/load.php. View all references

do_action( 'shutdown' );

Top ↑


Version Description
1.2.0 Introduced.

Top ↑

User Contributed Notes

  1. Skip to note 1 content
    Contributed by Philipp Stracker

    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.