Posted by & filed under Developer Blog.

I think I may have just discovered a major issue with WordPress. It would seem that WordPress is loading two pages at a time, the second loading after the first one has rendered on the screen, the other somehow in the background.

Here’s what I did to discover it. I’m hoping someone else can verify this and make sure it’s not just my environment and that I’m not just plain crazy!

  1. Create a fresh, new WordPress 3.3.1 instance on MAMP.
  2. Turn on WordPress DEBUG logging in the wp-config.php file.
  3. Turn on the permalink structure for “month and name” (http://localhost/fresh/2012/02/sample-post/)
  4. Create at least one extra page than the already generated Sample Page. I called mine “About Us.”
  5. Create a very simple plugin to track the $_SERVER[“REQUEST_URI”] call and send it to the log.
<?php
/*
Plugin Name: mytest
*/
 
add_action('init', 'mytest');
function mytest(){
    if(!is_admin())
    error_log($_SERVER["REQUEST_URI"]);
}
  1. Activate the plugin.
  2. Tail the log file (tail -f Sites/fresh/wp-content/debug.log) in Terminal.
  3. Visit your site and watch the log file. Visiting “Home” only causes the request to fire once, visiting the new About Us page only fires once. But, here’s the strange thing: visit the Sample Page and it fires both the Sample Page and the About Us page.
  4. Create more pages. Watch the logs.
  5. Wonder, “WHY??”

UPDATE: MAMP was the problem. Restarting Apache did the trick. I’m still not sure what caused it, but at least I know the root.