How to Fix SEO Problems When Adding WordPress Posts to Multiple Categories

Adding a WordPress post to more than one category can cause SEO problems.

It’s a problem that’s not too hard to avoid up front.

But it can be tricky to fix if it’s a problem that’s gone unnoticed for a long time.

The Main SEO Problem: Duplicate Content

It’s not well known, but if you have a url structure in WordPress of /category-name/post-name/. And you then add your post to more than one category, WordPress will now make that post available at multiple different url’s.

For example. If you add a post to ‘Category One’ and ‘Category Two’, both of these urls will now work:
https://example.com/category-one/post-name/
https://example.com/category-two/post-name/

Both urls will show the exact same post. This is not a bug, it is standard intended WordPress behaviour. But it’s also a potential ‘duplicate content’ problem in the making.

It’s even worse if you’re using sub-categories, as urls using those plus the main category will all work!

How WordPress Limits the Problem

WordPress does two things to help avoid this becoming an SEO problem. By:

1. Only Using One URL

First, WordPress only ever uses one of these urls. If you browse the category pages you will only see one version in use no matter which category you are in.

The way WordPress decides which url to use is a bit, well, ‘random’.

It’s not really random of course, but it doesn’t work the way most people would expect. You might think it uses the first category you choose and sticks to that version. No.

Behind the scenes WordPress assigns each category a unique numerical value – the next available one when the category is added. What it then does is use the ‘lowest numbered’ category of all the categories you select.

(Technical sidenote: this number, or category tag_ID, comes from the term_id in the wp_terms database table. It’s shared across all taxonomy terms including tags and categories. WordPress uses a centralized system for managing these.)

This means you have no real control over which url WordPress chooses. But at least it does choose only one. (We’ll cover how you can have more control over this shortly though.)

2. Using the ‘Canonical’ Tag

The canonical tag was created in 2009 by the three major search engines at the time (namely Google, Yahoo!, and Microsoft Live Search – now Bing). In order to provide a solution to exactly this problem of having the same content available at multiple different urls.

The tag itself is output by WordPress (and has been since 2009) in the source code of the page. It simply looks like this:

<link rel="canonical" href="https://example.com/category-one/post-name/">

That same tag code will be output no matter which url version you visit. Which tells Google etc which one is the correct url.

When Does This Become an SEO Problem?

This mainly becomes a problem if you change categories on a post. Or if you internally or someone externally links to the wrong url.

It can become a big mess when both of those things happen.

It’s not obvious that anything is going wrong. But what happens when you remove a category from an existing post? Or add a new category?

It can potentially change the url of the post but still leave the previous url working! And WordPress won’t warn you about that.

Ideally a post should never change url. But if it ever needs to there should be a redirect from the old url to the new one (or at least a ‘page not found’ error at the old url).

How Can Adding Extra Categories Change the Post URL..?

If a post only has one category it’s easy to understand why the url would change (from /old-category/post-name/ to /new-category/post-name/). It makes sense for the url to change.

What doesn’t make sense is adding an extra category making the url change. Yet it can, but may not!

Here’s why.

Remember we said WordPress chooses the ‘lowest numbered’ category to be the one it uses in the url?

So what happens if an existing post is in ‘Category Two’ and ‘Category Three’. It’s url is /category-two/post-name/.

But later you choose to add it to ‘Category One’?

WordPress will quietly change the url to /category-one/post-name/.

It will of course also quietly change the links used in category and tag pages. And also change the canonical tag. So things somewhat sort themselves out…

Only they don’t really!

Because the old url still works. It’s just not the correct one anymore!

So if you manually created any internal links to that post, they will not update and now link to the wrong url.

Or if any other website had linked to that post (backlink from another site, content shared on social profiles etc).

Now you have links pointing to two different urls. Both showing the exact same post. Say hello to ‘duplicate content’.

Canonical Tag to the Rescue?

The canonical tag will certainly help to resolve this. As Google themselves say, the canonical tag is “a strong signal” that the specified url is the right one.

But it is only one signal, and ultimately Google (and the other search engines) will decide which one they think is the right one. And links are a part of that decision.

So you can end up with Google sending traffic to one url. While people following old links end up at a different one! Or Bing sends traffic to a different one.

Does It Matter?

This can cause major confusion in Google Analytics, Google Search Console and other reporting tools. Because you’ve now got traffic split across different urls that are actually the same page!

It also causes some confusion to Google. It’s rarely a good idea to leave it up to the search engines to decide what’s correct.

How To Fix This

Fixing the problem essentially means forcing everything back to one definitive url.

So that means redirecting the old url to the new one (using a ‘301’ redirect to indicate this is a permanent change). Also updating any manually created internal links would be best practice too.

The easiest way to to figure out what is now the correct url is to go to the main Posts screen in WordPress. When you hover your mouse over a post the ‘View’ option gives that definitive url to use.

Get in touch if you’d like us to help with this or any other SEO related problems.

How To Avoid Future Problems

If you do change categories be aware that the url may change. And if it does change, then you need to change manual internal links to use the new url. And also ‘301’ redirect the old url to the new one.

Can SEO Plugins Prevent Category/URL Change Problems?

Some SEO plugins give you more control over what the url will be when multiple categories are being used. But they don’t necessarily fix the problem we’ve covered.

The highly popular ‘Yoast SEO’ for example adds a ‘Primary category’ feature. So when you set your post categories, you can then also define which one is ‘Primary’. And this category is then used to define the url used by WordPress (links in category pages, canonical tag etc). The ‘Rank Math’ plugin has a similar ‘Primary Term’ option.

This helps a lot. Because it means the url won’t change when you add or remove categories. Unless you change the Primary category (which is more predictable and understandable).

But even the Pro version of Yoast SEO doesn’t (currently) detect a change in Primary category as being a url change. So it won’t create, or even prompt you, to create the redirect you really want for this.

And you still need to manually change your internal links (or leave undesirable 301 redirects lying around).

What about Globally Redirecting Everything to One URL?

This is not a bad solution to cleaning up the problem in a more ‘one and done’ manner. With custom coding we can automatically redirect all of those extra category urls to the one definitive url.

It just needs doing very carefully to avoid destroying a site in Google. 🙂 It also needs to work alongside any SEO plugins in use to ensure the right url is used throughout.

You still have the issue of tidying up manually created internal links though.

Choose your categories wisely folks.

Share