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;

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!

  • Look at your server access logs, you might actually be requesting twice (e.g. once for the page, second for an AJAX call) – webaware Feb 1 '13 at 13:25
  • Suppose favicon request? – Eugene Manuilov Feb 1 '13 at 13:47
  • Your server logs should tell you which files are being requested. That should narrow this down. – s_ha_dum Feb 1 '13 at 14:26

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.


Search for 'wp', and "wp" (quotes included) in the files of your plugins directory and sub-directories (default wp-content/plugins) and your current theme's directory and sub-directories (default wp-content/themes/YOUR-THEME).

In WP core files (3.5), the wp action is only fired once, with do_action_ref_array in wp-includes/class-wp.php. Probably a 3rd party (plugin/theme) is calling do_action('wp'....

Note: a quick way to rule out a misbehaving plugin is put your testing code in your theme's functions.php, rename your plugins directory to something like plugins.temp and access your front-end. Then, rename your plugins directory back to plugins.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.