I noticed that when I hook into ‘wp’ it seems to be firing twice — for example

add_action('wp', 'just_testing');
function just_testing(){
    global $post;
    error_log($post->ID);
}

returns into my error_log the following two entries:

[01-Feb-2013 13:06:58 UTC] 1120
[01-Feb-2013 13:06:58 UTC] 

I searched google and stackexchange and the thread “What would cause the ‘wp’ action to fire twice per page (but only once per post) in Firefox only?” does not apply because I am getting the two firings in all browsers.

Thanks for any help!

2 Answers
2

It can happen if one of the files you include in the theme is returning 404 Not Found error. Like, if you’re linking to a .js or .css or an image which does not exist on that location. Use the Inspector in your browser to see if you get any 404 errors, anywhere.

Fix them and try again.

Leave a Reply

Your email address will not be published. Required fields are marked *