• How is this possible? I thought WordPress disallowed duplicate slugs. I have a site with the following pages:

    1. domain/parent-page/child-page
    2. domain/child-page

    Each of the pages has identical titles and slugs with the exception that one of the pages has a parent page.

    I thought WordPress disallowed this and would assign “-2” to the slug of the most recent page.

    Am I misinformed?

    Thank you.

Viewing 2 replies - 1 through 2 (of 2 total)
  • For pages, it’s only if they are on the same level. As the first URL that you gave is a sub-page, it will only do that if there’s another sub-page of that parent page with the same URL slug.

    Hello Tim,

    WordPress indeed has a feature to prevent duplicate slugs by appending a “-2” to the slug of a page or post with the same title as an existing one. It doesn’t include parent pages when generating slugs for hierarchical URLs (parent and child pages). When you create a child page, it automatically becomes a part of the URL structure of its parent page. However, WordPress does not factor in the parent page when generating the slug for the child page. It only checks for uniqueness among other sibling pages and top-level pages.

    1. domain/parent-page/child-page: This is a child page under “parent-page.” The slug for this child page is generated based on its title and sibling pages at the same hierarchy level. Since there are no sibling pages with the same title in the “parent-page” hierarchy, no “-2” is appended to the slug.
    2. domain/child-page: This is a top-level page, not a child of any other page. The slug for this page is generated based on its title and sibling pages at the top level. If there are no other top-level pages with the same title, no “-2” is appended to the slug.
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Duplicate page slugs?’ is closed to new replies.