[wp-hackers] Action question.

Peter van der Does peter at avirtualhome.com
Thu Sep 23 19:44:24 UTC 2010


On Thu, 23 Sep 2010 13:49:42 -0400
Andrew Nacin <wp at andrewnacin.com> wrote:


> 
> 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.

I was debugging some stuff with a preprocess_comment action and while
debugging the get_header action didn't show up in my
step-by-step debugging session, but I understand the reason now, the
debugging session stopped when the redirection was done.

Thanks for the thorough reply.

-- 
Peter van der Does

GPG key: E77E8E98

IRC: Ganseki on irc.freenode.net
Twitter: @petervanderdoes

WordPress Plugin Developer
Blog: http://blog.avirtualhome.com
Forums: http://forums.avirtualhome.com
Twitter: @avhsoftware


More information about the wp-hackers mailing list