9

I have two pages - new.hillsong.com/australia/sisterhood - new.hillsong.com/hills/sisterhood

Both pages are displaying the content for the /hills/sisterhood site but they are different pages with different content. I can't seem to find anything online about this. Is this possible? Are there any ways to make this work.

Thanks for the help! Paul

1

4 Answers 4

7

Yes, you can.

In the old days, this was not possible (as evident from other answers). However, it's possible now.

WordPress now lets child pages (of any post type that is hierarchical) from different parents to have the same slug / name. This is possible because now WordPress considers the entire hierarchical tree (parent-child combination) for uniqueness check.

So the following page URL(s) are possible now:

example.com/parent-1/child
example.com/parent-2/child
4
  • 2
    Hi, how could that be achieved? By default, I couldn't create the same slug for different pages with different parents. WP version is 4.9
    – quento
    Commented Nov 29, 2018 at 14:00
  • What is your permalink setting?
    – Fayaz
    Commented Nov 29, 2018 at 20:11
  • it's '/%category%/%postname%/'
    – quento
    Commented Dec 1, 2018 at 8:14
  • 1
    I just tested it on WP 5 and it's possible. Create two parent pages /en/welcome /another-lang/welcome Commented Sep 24, 2019 at 12:35
1

I know its an old post, but thought is was worth mentioning (for those like me finding it in search engines).. What I use to get around something similar is a Custom Permalinks plugin. (https://wordpress.org/plugins/custom-permalinks/).

I have been using this plugin for a number of years on about 30 client websites and have never had an issue with it, and it will allow you to create almost any url you like.. if you have 2 or more URLs ending in /sisterhood/, it will do that without any issues, regardless of what the slug is.

1

No, at the time of writing this, no you cannot. Once a slug is used by a page, it cannot be used by other pages. It also can't be used by other posts, regardless of post types

There is a Trac ticket on WP Core that's attempting to fix this so that a slug can be reused by post type, but that would still only allow you one use of your page slug. The chances that you could do what you're trying to do are remote at best, and vanishingly small at worst.

The nearest you could get to this is by adding a /sisterhood/ endpoint via the rewrite rules interface, which would allow you to change the content of a page when the sisterhood endpoint is present. However, this endpoint is just that, an endpoint, it isn't a page with post meta and content, it's just the same page but with an endpoint ( in this case, you'd still be on the Australia page, you'd just have the option to show something different )

Rewrite rules and endpoints are not for the faint of heart, if you're interested in this, I advise you ask the question:

"How do I add a page endpoint? I'm trying to add a sisterhood endpoint to my pages, so that I can display a different template. How do I add the endpoint then load a different template?"

Make sure you link here, and you put the new question link here too

2
  • it is now possible Commented Sep 24, 2019 at 12:36
  • Note the date, when this answer was written you could not
    – Tom J Nowell
    Commented Sep 24, 2019 at 16:45
0

The easiest way to do it is to not use pages for that, but instead create a new post types for "hills" and/or "australia" this can be a PITA but you need to understand that the combination of post type and slug should be unique (the reason it is done this way is to let you change the permalink structure without having to update whole of the content).

Another option it seems like you need to consider is to use a multisite install with a subdirectory structure. This depends on how distinct are "australia" and "hills" sections and if you have to have aggregating things like native search working on all of your content.

Most complex option is to write your own url parsing. For example, check in your functions.php if the url is "hills/sisterhood" before any template handling code is loaded, and replace the query with one that will serve the specific page you want. The problems here is that it is hard to scale and you might need to find a solution to generating a proper permalink for the page for example to be used in your site map.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.