[wp-trac] [WordPress Trac] #18962: Allow duplicate slugs for different content

WordPress Trac wp-trac at lists.automattic.com
Tue Dec 27 00:16:55 UTC 2011

#18962: Allow duplicate slugs for different content
 Reporter:  maorb          |       Owner:
     Type:  enhancement    |      Status:  new
 Priority:  normal         |   Milestone:  Awaiting Review
Component:  Rewrite Rules  |     Version:
 Severity:  normal         |  Resolution:
 Keywords:                 |

Comment (by hearvox):

 You can use the same slug in multiple hierarchical post types, but only
 for a page that is NOT top-level, AND NOT the same level w/in the same
 post type.

 The function wp_unique_post_slug() disallows identical slugs for the same
 post_parent. and since all top-level pages of heirarchical pages have a
 [post_parent] => 0, they can't have the same slug.

 Not sure if that's intentional, but it is the result. Been testing it
 lately, here's the URLs possible:







 All the above "test" slugs have a different [post_parent], so the
 identical slug is allowed. All the above "test-2" slugs had the same
 parent as another "test" slug, so the "-2" was added.

 In the case of "/cpt-name/test-2/" the post_parent was 0, same as
 "/test/", so its slug got a "-2."

Ticket URL: <http://core.trac.wordpress.org/ticket/18962#comment:4>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software

More information about the wp-trac mailing list