WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] Post & Page with the same slug

[Resolved] Post & Page with the same slug

  • If you create a post with a title (and slug) – I’ll use test as an example – and later create a page with the same title/slug, WordPress doesn’t notice the collision and try to change the slug for you. If you try to create/change a post’s slug to an existing post slug, it’ll put a ‘-2’ at the end. Same with a page. But WP doesn’t seem to cross-check between posts and pages.

    Is this a bug, or just the way it is (for whatever reason)?

Viewing 8 replies - 1 through 8 (of 8 total)
  • Moderator Mark Ratledge

    @songdogtech

    Forum Moderator

    WP does “check” and notice the potential collision; that’s why WP adds the -2. It’s not a bug. The “whatever reason” is to prevent slug collisions.

    That’s the way WP works to prevent slug collisions. Any site can have a `%postname% permalink structure, and that will show the same slug for a post and page.

    What I’m saying is WP does *not* check for collisions between post and page. This was tested on a clean 3.5 install.

    Moderator Mark Ratledge

    @songdogtech

    Forum Moderator

    What I’m saying is WP does *not* check for collisions between post and page.

    Yes, it does. And WP adds the -2 to prevent collisions. What’s your definition of “check?”

    In my tests it does not put the -2. If, like I said in the OP, you test post-to-post or page-to-page, it does add the -2. But if you have a post with slug “whatever”, and you later add a page “whatever”, WordPress lets you. Same slug for page & post. The post is now inaccessible.

    I agree with AK Ted. I have a new site with 3.5 and it is not checking post slugs to page slugs and adding the -2 like it would if I add another post

    Trac ticket created, will update this thread as necessary.

    My ticket has been closed and marked as a duplicate of this Trac ticket, which was filed nearly 2 years 8 months ago.

    same problem… and why are moderators so eager to close threads calling them resolved… when … they are not… (in favor of something that was started three years ago)

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘[Resolved] Post & Page with the same slug’ is closed to new replies.
Skip to toolbar