I'm using Toolset Types to create a custom post type, and within that post type there is a taxonomy. I have created two posts with the same name, but in a different taxonomy.

For the purposes of example:

  • my custom post type is called "food"
  • my taxonomies are called "German" and "English"
  • my post name is "sausage"
  • I want two different posts, one "sausage" within the "German" taxonomy, and one "sausage" within the "English" taxonomy.

At the moment, my "German sausage" post is at the URL: sitename.com/german/sausage.

My "English sausage" post is at the URL: sitename.com/english/sausage-2.

Here you can see my problem: the second post with the same name has a -2 tacked on to the end of the URL. My question is, how can I remove this, so that the URL becomes sitename.com/english/sausage? Technically, this should be possible given the fact that they are in different taxonomies.

If you can explain what needs to be done to me (I'm fairly comfortable with PHP and MySQL), I'm happy to code it myself, although of course I'll be very grateful if you can code a fix yourself. Ideally I won't have to use a workaround such as a rewrite rule or a new post type as well.

Thank you so much for your time and help.

  • "sausage" must be unique because it is the post_name (slug) and does not depend on any taxonomy. Commented Feb 22, 2017 at 19:20

1 Answer 1


It can be done by using the request filter. Something like this

 function alter_the_query($request) {
       return array('page' => 1, 'pagename' => null);


Here it forces display of post 1, though of course you will want to do a query to determine the ID. For that, it might prove easiest to first parse the actual URI (from $_SERVER['REQUEST_URI']) rather than use whatever info. WordPress provides (escaping the query string for security reasons, or using prepare()). Also, you may need some conditionals at the begining so it won't break editing, archive display, etc.

Your Answer

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