WordPress.org

Ready to get started?Download WordPress

Forums

Should allow same post_name accross different post_type (1 post)

  1. olivM
    Member
    Posted 3 years ago #

    i can't figure why wp_unique_slug doesn't allow 2 posts from differents post_type to have the same post_name.

    let's say i have 2 custom post types : style and group
    both being hierarchical
    i first create the 'Hip-Hop' style ( which got the permalink : /style/hip-hop )

    then i try to create the 'Hip-Hop' group ( which would have the permalink : /group/hip-hop )

    but wp_unique_slug do this query :

    SELECT post_name FROM wp_posts WHERE post_name = 'hip-hop' AND post_type IN ( 'page', 'group', 'style' ) AND ID != 16405 AND post_parent = 12867 LIMIT 1
    where it should simply be :
    SELECT post_name FROM wp_posts WHERE post_name = 'hip-hop' AND post_type = 'group' ) AND ID != 16405 AND post_parent = 12867 LIMIT 1

    as soon as the custom post types has rewrite enable, there won't be duplicates urls...

    where am i missing a point needing different post_name ?

    thanks

    olivier

Topic Closed

This topic has been closed to new replies.

About this Topic