Searching for a solution on how to fix duplicate category slugs in your WordPress permalinks? WordPress doesn’t allow you to use the same terms for pages, categories and post tags so if you have already made this mistake, you’ll find the solution here.
In this tutorial, you’ll learn how easy it is to fix duplicate categories/category slugs.
Here’s an example:
http://wpsites.net/wordpress-themes-6/how-to-edit-category-slugs/.
You can see the -6 next to the category slug, wordpress-themes.
This problem occurs when you create a page title, category or post tag using exactly the same term or terms as an existing Category, Post Tag or Page Title slug.
The above screenshot shows one category which is correct wordpress-themes
Its also shows 3 duplicate categories which are wordpress-themes-4, wordpress-themes-5 and wordpess-themes-6
This has been caused by naming a page wordpress themes which has the same permalink slug as the category wordpress themes: wordpress-themes. This is Not unique therefore WordPress adds a number onto the end of the category slug as seen in the above screenshot.
Watch the video to learn how to fix this problem so you don’t end up with duplicate categories.
Lets also take a look at the best method to find duplicate category slugs and fixing them.
How To Find Duplicate Category Slugs
First step is to check your existing categories to find duplicates.
Go to Posts > Categories
You’ll see in this example that there is the number 2 next to the Category blog which means its a duplicate and needs to be fixed. The reason its a duplicate is because there must also exist a Page or Post Tag with exactly the same term in the slug, in this case its blog.
In this case the category hasn’t been duplicated but the slug has as its been used somewhere else in a page or tag which needs to be located and fixed.
I located the Post Tag with the same name and deleted it. Another option is to rename the tag to something similiar as long as its unique.
Then i went back to categories and deleted the 2 from the end of the blog slug so the Category went from blog-2 to blog.
To do this you’ll find a quick edit link under each category name. Click this to edit the name of the category and corresponding slug.
Clicking the Quick Edit link allows you access to the category name and slug shown in this screen shot.
What if you already have multiple duplicate categories?
Fixing Multiple Duplicate Categories
If you have created posts to a category name which has already been used as a post tag or page title then that slug will not be uniqiue and you can end up with multiple categories numbered 2,3,4,5 and so on.
Simply deleting the numbers from the end of the category term in the slug (like what is shown above) won’t work as that term is already in use by another category, page or page slug. So how do you fix this problem?
You need to assign the posts which are currently assigned to the categories with 2,3,4,5 and so on next to the category slug to the correct category after you delete or change the page or post tag slug with the same name.
With post tags this isn’t a problem as long as you make sure the edited tag is unique and descriptive of the content of the post.
With page titles, you’ll need to change the permalink page slug to something unique and redirect it to the new page slug using a redirection plugin or 301 redirect if your theme allows this.
I’m using the WordPress Seo by Yoast plugin which includes a field under the Advanced section for 301 permanent redirects. Another option would be to use a Permalink Finder plugin or simply test it after you have made the changes to see if it automatically redirects to the new permalink slug.
How To Assign Existing Posts To a New Category
The video at the start of this post shows you how to clean up multiple categories.
Lets take a look at fixing multiple category slugs from another angle. Go to Posts > All Posts and navigate to the View all categories search box next to the Filter button.
Highlight the Category you wish to fix using the View all categories tool and click Filter. This will display all the posts under that category so you can re assign them to the correct category.
To re-assign posts from a duplicated category to the correct category, simply deselect the duplicate category and then select the correct category the click the Update button.
After this is done, delete the duplicate categories which contain the numbers after the category slug. i.e Delete the categories you have reassigned posts from which contain 2,3,4,5 and so after the category slug.
Delete Duplicate Category
Once you have re-assigned all posts from all your duplicate categories its time to check that your posts are now filed under the correct category and delete all the duplicate categories which should not contain any posts as you have re-assigned them to the correct category.
I hope this tutorial and video have helped you learn more about how to edit, change and fix WordPress Categories as well as how to find duplicate post tags and page title slugs.
Once you understand how to quickly check for duplicate page, category and tag slugs, you’ll be able to prevent these problems from happening in the future.
Was This Tutorial Helpful?