I have added a custom post type and assigned taxonomy to it by following this tutorial: Custom Post Type / Taxonomy Slug / Post Title with post type archive

I have two terms in custom taxonomy .

  1. work-cat-1
  2. work-cat-2

when a post is under 'work-cat-1' the url is http://localhost/wordpress/our-work/work-cat-1/test-work/

if I change the url in the address bar and replace "work-cat-1" with any random word like "abcdef" then the link should not work .

But localhost/wordpress/our-work/abcdef/test-work/

is showing the post linked to


How to resolve this issue ??

  • If you want to enforce the correct term, you have to modify the default query to incorporate that data. The answer is similar to the last part of this answer, with taxonomy instead of meta parameters, though I question how necessary this is, considering the unlikely case where some random string is going to end up in the middle of your permalink.
    – Milo
    Jul 22, 2015 at 18:45
  • Thanks !! That answer you mentioned helped..Now I'm playing with that Jul 25, 2015 at 2:40


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.