Is the code on a WordPress shutdown hook always executed and if so, when?
- User
Is the code on a WordPress shutdown hook always executed and if so, when?
Assistant
WordPress shutdown hooks are executed at the very end of the PHP execution cycle, after WordPress has finished sending the response to the browser. However, they are not always guaranteed to execute.
The shutdown hook runs when:
- The page request completes normally
- PHP encounters a fatal error (in most cases)
- The script execution ends naturally
The shutdown hook may not execute when:
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.