I have multiple posts with the same title, e.g.

  • /states/new-york
  • /cities/new-york
  • /counties/new-york

but WordPress doesn’t allow duplicate slugs, so they appear like:

  • /states/new-york
  • /cities/new-york-2
  • /counties/new-york-3

When I managed to allow duplicate slugs, all of these posts loaded on the same page at the same time. The post cities/new-york is about New York City, and the post /states/new-york is about New York State (these are just examples). Obviously none of these posts share categories.

It seems my problem is largely with redirect_canonical(), which will redirect /cities/new-york/ to /states/new-york/, though the second step is failing me. A 301 redirect plugin will not suffice, as /cities/new-york/ also belongs to /big-cities/new-york/ and /us-cities/new-york/ and there are at least 60 of these posts.

Read more here: Stop redirecting to posts not in a category / duplicate slugs


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


Wordpress related questions and answers: