With add_action, I want to intercept as early as I can in my plugin and send a 304 Not Modified header per some rules. Does anyone know what the order is of events? When I view this page, it seems to hint that the best place for this would be plugins_loaded, and that it comes before the init event. Is that correct? The page in that link doesn’t describe what the event order is, but seems to imply it.
Leave a Reply
You must be logged in to post a comment.
The page you referenced does have the correct order of events listed there. If you want to see which events were fired for a particular request you can install debug-bar and debug-bar-action-hooks.
If you are wanting to send a header either
plugins_loaded
orinit
will work. But it is recommended to use thesend_headers
action that is fired just after the request is parsed, also if your rules depend on data inWP_Query
you will need to usesend_headers
.