• Resolved rookiecop

    (@rookiecop)


    Hi, would someone be as kind to explain what permalinks structure I need please based on my desired structure. It’s pretty basic but I’ve been tearing my hair out for hours, many thanks in advance….

    Top Level category: News
    Child category: Subcat 1

    Permalinks Option 1 –
    Custom Structure = /%category%/%postname%/
    Subcat Result: mydomain.co.uk/category/news/subcat-1/ (wrong)
    Post Result: mydomain.co.uk/news/subcat-1/hello-world/ (correct)

    Permalinks Option 2 –
    Custom Structure = /%category%/%postname%/ with ‘news’ as Category Base
    Subcat Result: mydomain.co.uk/news/news/subcat-1/ (wrong)
    Post Result: mydomain.co.uk/news/subcat-1/hello-world/ (correct url but 404 error)

    Desired results:
    mydomain.co.uk/news/subcat-1/
    mydomain.co.uk/news/subcat-1/hello-world/

Viewing 3 replies - 1 through 3 (of 3 total)
  • I think your “problem”, if we can call it so at all, is not what permalink structure you need to use, but a missing link in the understanding of WordPress’ category URLs work.

    Subcat Result: mydomain.co.uk/category/news/subcat-1/ (wrong)
    Subcat Result: mydomain.co.uk/news/news/subcat-1/ (wrong)

    WordPress will ALWAYS add the category base /category/ by default (in your first case), /news/ in your second case…. to category URLs. This is irrespective of what permanent structure you use (other than Default/Plain).

    The reason for this is so WordPress can distinguish between category (or generally, taxonomy) URLs and post/page-type URLs.

    There are solutions out there to remove the category base. For instance, the Yoast SEO plugin has a checkbox to stip out the category base. There are plugins that do just this as well. And if you don’t want to use a plugin, there are lots of custom PHP code floating on the internet to remove the category base in category URLs.

    But I’ve NEVER seen one that doesn’t lead to other problems as your site grows (commonly, 404 errors on paginated category archive pages, 404 errors in Woocommerce product category archives, and other edge cases).

    Thread Starter rookiecop

    (@rookiecop)

    Thanks for taking the time to explain this George, much appreciated.

    Thread Starter rookiecop

    (@rookiecop)

    I’ll just mark this as resolved ??

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Permalinks Problem’ is closed to new replies.