admin管理员组文章数量:1321449
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 'mysite/cars/bugatti' as well as 'mysite/supercars/bugatti'.
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 'mysite/supercars/bugatti' and any secondary category URLs ( i.e. 'mysite/cars/bugatti', 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!
本文标签: permalinksUsing 39Primary Category39 in URL
版权声明:本文标题:permalinks - Using 'Primary Category' in URL 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742100338a2420773.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论