WordPress.org

Ready to get started?Download WordPress

Forums

Bug? WP allows duplicate URLs for pages and posts (10 posts)

  1. Rich Owings
    Member
    Posted 10 months ago #

    This appears to be an issue when using the permalink structure http://mydomain.com/sample-post/

    I have a page with the URL http://localiswhereitsat.com/google-business-page/

    This morning I published a post that I had (unintentionally) given the same slug to. When I went to View Post it took me to the page, not the post I had just published.

    I renamed it http://localiswhereitsat.com/well-developed-google-business-page/ but WP shouldn't allow this. IMHO, it should treat it like a duplicate post URL and give it the slug http://localiswhereitsat.com/google-business-page-2/

    Can anyone verify that this is really a bug and not unique to my installation?

  2. Rod Whiteley
    Member
    Posted 10 months ago #

    I have just confirmed it in WordPress 3.6.1. The post content appears correctly in the blog, but the link goes to the page.

  3. esmi
    Forum Moderator
    Posted 10 months ago #

    I'm not convinced that this is a bug per se. Posts and Pages are quite different objects, so giving the new object an url of -2 doesn't really apply.

  4. Rod Whiteley
    Member
    Posted 10 months ago #

    The bug is that the post is unreachable using its permalink. Whether adding -2 is the best way to fix the bug is perhaps a matter for debate. It is certainly one way to fix it, and it is consistent with the way WordPress behaves in other circumstances.

  5. Rod - Can you test this on WP 3.5.2?

    Also have you both tested with all plugins off?

  6. Rich Owings
    Member
    Posted 10 months ago #

    I just verified that it does this in 3.6.1 with all plugins disabled.

  7. This appears to be intentional per http://core.trac.wordpress.org/attachment/ticket/18962/wp-includes_post.diff

    Since posts and pages (and custom post-types) are all separate groups, they dont' check for collisions.

  8. Rich Owings
    Member
    Posted 9 months ago #

    It may be, but it still makes for a bad user experience.

  9. Rod Whiteley
    Member
    Posted 9 months ago #

    Since posts and pages (and custom post-types) are all separate groups, they dont' check for collisions.

    Ha-ha! Working as coded!

    What really happened was that one developer thought it would be a good idea to separate posts and pages into separate namespaces, while another developer thought it would be a good idea to allow one of the standard permalink structures to make posts and pages share a namespace. The result is that a post's permalink doesn't always link to the post. I call that a bug. Yes, it was "intentional" but the intention wasn't very well thought out.

  10. esmi
    Forum Moderator
    Posted 9 months ago #

    What really happened was that one developer thought it would be a good idea to separate posts and pages into separate namespaces

    No. All core development is community-driven. No one person gets to decide anything. Posts and Pages are completely separate objects. They are coded differently. Have different taxonomies/hierarchies. Different query objects. They are... different.

    If you stick with the default permalink structure this kind of collision never happens. Ergo, it's not a Page or Post coding issue. It only happens when people try to impose permalink structures that rely purely on object titles - instead of using numeric or date based permalink structures for Posts as most coders would still recommend & use themselves.

Reply

You must log in to post.

About this Topic