Using ‘Primary Category’ in URL


I’m running into an issue where I want to set up categories in my URL (%category%/%postname%), but doing this will create multiple URLs for the same content if I select multiple categories.

So, for example, if I put a ‘Bugatti’ post in the ‘cars’ and ‘supercars’ categories, the ‘Bugatti’ post will be available at both ‘’ as well as ‘’.

I want to restrict this to where the content will only be available for the primary category that I select. So if I select the category ‘supercars’ as my primary category, the post ‘bugatti’ will only be available at ‘’ and any secondary category URLs ( i.e. ‘’, etc. ) would return a 404. Is there any way to do this using the ‘primary category’ from Yoast or otherwise?

I noticed that Wirecutter does this for their site. They’re running WordPress, using a %category%/%postname% permalink structure, but any of their secondary categories in the URL only return a 404.

Thanks for any help you can provide!

leighton_burley 2 years 2020-09-25T14:10:28-05:00 0 Answers 15 views 0

Leave an answer