[wp-hackers] Action question.
Andrew Nacin
wp at andrewnacin.com
Thu Sep 23 17:49:42 UTC 2010
On Thu, Sep 23, 2010 at 10:34 AM, Peter van der Does <peter at avirtualhome.com
> wrote:
> Is it correct the action get_header isn't fired when a comment is
> posted?
>
On the trip to the server, WordPress hits wp-comments-post.php, which means
no templating is loaded at all. So no, the get_header hook would not fire.
WordPress then sends a redirect header back to the browser, at which time
the post where the user came from is then requested by the browser, and
get_header would indeed be fired.
A note though, it's best to use hooks that are relevant to what you're
trying to achieve. Think semantically, if you will. Don't try firing code
off get_header that isn't related to building the header template, for
example. You may wish to look at hooks such as wp_head, template_redirect,
init, or a slew of hooks in wp-comments-post.php, depending on what you're
trying to do.
More information about the wp-hackers
mailing list