[wp-hackers] Attempt to fix separate subpages w/ same slug name

Owen Winkler ringmaster at midnightcircus.com
Thu Oct 6 15:06:42 GMT 2005


Mike Matz wrote:
> However, as you probably know, Wordpress chokes when the slugs are the 
> same, even if they are children of separate pages.  I had to work around 
> this problem somehow, and this isn't the cleanest way but it works.  I 
> just add an extra db query to find the proper post ID, based on each 
> parent.  I've attached the patch output in case anyone wants to use this.

Try these patches on 1.6.

Instead of adding to the existing posts query, I have 
update_category_cache() build $cache_category->fullpath which contains 
the full path of the category and its parents.  Then when a category is 
requested, it looks for the full path among the $cache_category array. 
If it can't find it, it looks for the last directory in the path.

These patches reduce the potential number of queries used by 1.

Please *test*.

Owen
-------------- next part --------------
A non-text attachment was scrubbed...
Name: classes.php.diff
Type: text/x-patch
Size: 2009 bytes
Desc: not available
Url : http://comox.textdrive.com/pipermail/wp-hackers/attachments/20051006/27c22783/classes.php.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: functions.php.diff
Type: text/x-patch
Size: 966 bytes
Desc: not available
Url : http://comox.textdrive.com/pipermail/wp-hackers/attachments/20051006/27c22783/functions.php.bin


More information about the wp-hackers mailing list