0

I have a situation I cannot quite understand, and wonder if someone could help me do so.

We are developing an e-commerce store (WP + Woocommerce)

Individual artists are represented by Pages (each called with a slug ). There is a single parent page to all individual artist pages called 'Artists'

Products are recordings, with variations corresponding to each Format attribute. they are grouped into Categories. For each artist (page) we created a Woocommerce category with exactly the same name and slug.

If in Settings/Permalinks, we set the product category base to 'Artists', then users clicking on the link to a product category are sent to the Artist page (and not the product category page).

Now : we are very happy about this, but fail to understand why this is the case, e.g. how does WP decide what page is what in this case?

What is the underlying logic?

  • WordPress really really really dislikes different things having same slugs. Usually whenever that comes up things get wonky. You just learn to stay away from that as much as possible. :) – Rarst Jul 11 '16 at 18:14
0

In general page URL are "last resort" match when nothing else fully matches the URL. This means that you can have something like example.com/category/cat1 be a URL of a category and example.com/category/cat1/page1 be a URL of a page. For the last to work you obviously need a grandpa page with slug "category" and a father page with slug "cat1".

It is not actually surprising when you understand that there have to be hierarchy of URL parsing that will at least resolve which rule "wins" when 2 rules match the URL, but usually it is a sign of bad URL design, or at least I haven't seen yet anyone that uses it in real life as the results are confusing.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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