[wp-testers] wp3 loading multiple pages unnecessarily

Steve Zehngut steve at zeek.com
Wed Jul 21 20:02:31 UTC 2010


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.



Steve Zehngut
Zeek Interactive, Inc.

5267 Warner Avenue #189
Huntington Beach, CA 92649

714-596-ZEEK (9335) Tel
714-843-9251 Fax
310-666-7000 Cell

http://www.zeek.com
mailto:steve at zeek.com
AIM: Zengy
Facebook: http://facebook.com/zengy
Twitter: @zengy
Skype: stevezehngut





More information about the wp-testers mailing list