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?

1
  • 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
    Commented Jul 11, 2016 at 18:14

1 Answer 1

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.

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.