Where’s The Best Place to use Register_Shutdown_Function()?
WordPress core register a shutdown function on its own (source) the function shutdown_action_hook registered to be ran on shutdown, call do_action( ‘shutdown’ ); and little more (source). So, if you want to register a shutdown function in WordPress way just add your function on ‘shutdown’ hook: add_action( ‘shutdown’, ‘my_shutdown_callback’ ); function my_shutdown_callback() { error_log(‘Goodbye’); } … Read more