[wp-trac] [WordPress Trac] #14382: extra pages loading unnecessarily

WordPress Trac wp-trac at lists.automattic.com
Wed Jul 21 21:23:18 UTC 2010


#14382: extra pages loading unnecessarily
--------------------------+-------------------------------------------------
 Reporter:  zengy         |       Owner:                            
     Type:  defect (bug)  |      Status:  new                       
 Priority:  normal        |   Milestone:  Awaiting Review           
Component:  General       |     Version:  3.0                       
 Severity:  normal        |    Keywords:  permalinks, wp_head, pages
--------------------------+-------------------------------------------------
 I have a WP3 issue that I came across and I thought it should be posted
 here. I apologize if this has been posted previously. Please let me know
 if this issue exists as a current known bug.

 I am coding a plugin that needs to do something on 'wp_head'. I was
 noticing that it was executing my code twice. I am now using error_log()
 to display the post ID and it is displaying the ID of the page I am
 loading plus another page ID.

 This only happens when loading pages that have subpages associated with
 them. This bug occurs when a custom permalink structure is chosen. It does
 not happen when using the default permalink structure.

 Here are steps to reproduce this issue:

 1) Create a new WP3 site and create a .htaccess file.

 2) Install and activate this plugin:

 <?php

 /*
 * Plugin Name: Post ID Test
 */

 function display_post_id() {
         global $post;
         error_log('post id: ' . $post->ID . ' | post title: ' .
 $post->post_title);
 }

 add_action('wp_head', 'display_post_id');

 ?>

 3) Create the following pages:

 Page 1 (no parent)
 Page 1.1 (parent = Page 1)
 Page 1.2 (parent = Page 1)
 Page 2 (no parent)

 4) Change the permalink settings to "Day and Name".

 5) Visit the front end for Page 2. Your error log will be something like
 this:

         [21-Jul-2010 19:59:04] post id: 10 | post title: Page 2

 6) Now visit the front end for Page 1. Your error log will be something
 like this:

         [21-Jul-2010 20:00:46] post id: 4 | post title: Page 1
         [21-Jul-2010 20:00:47] post id: 6 | post title: Page 1.1

 7) Page 1.1 generates the following:

         [21-Jul-2010 20:00:58] post id: 6 | post title: Page 1.1
         [21-Jul-2010 20:00:58] post id: 8 | post title: Page 1.2


 I tried this in W 2.9.2 and the issue does not exist.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/14382>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list