Skip to content

Canonical URL

A canonical URL is the one address chosen to stand for a page that can be reached at several. WordPress names it in a rel="canonical" link on single posts and pages. Search engines treat that link as a hint and may choose another address.

By
WP Ministry
Published

In short

  • A canonical URL is the address that represents a page in search results when several addresses show the same content.
  • WordPress prints a rel="canonical" link by itself on single posts and pages, and on nothing else.
  • The link is a hint. When a page has moved, use a redirect, which also moves visitors.

A canonical URL is the one address that stands for a page when the same content answers at several. https://example.com/shoes/, the same address with ?utm_source=newsletter on the end, and its http form can all show one page. A search engine keeps one of them, shows it in results, and gathers what it knows about the others, such as links to them, onto that one.

Two choices are involved. You state yours with a link in the page's head, which the specification calls the author's preferred version:

html
<link rel="canonical" href="https://example.com/shoes/" />

Google then makes its own. Its documentation says a canonical preference "is a hint, not a rule". Redirects and rel="canonical" links count as strong signals, and a sitemap as a weak one.

Where you meet it

  • In a page's source. WordPress prints the link by itself on a single post, page or other single item. The address is that item's permalink. The blog's index, category and tag archives, and search results get none from WordPress. A plugin can change the address through the get_canonical_url filter, so what your site prints may differ.
  • In Search Console. The URL Inspection tool shows "User-declared canonical" and "Google-selected canonical". The Page indexing report uses the word in reasons such as "Duplicate without user-selected canonical" and "Duplicate, Google chose different canonical than user".
  • WordPress's "canonical redirect". This is a different thing with a similar name. When someone asks for a variant of an address, such as one without its final slash, WordPress answers with a 301 redirect to the proper form. The link is a note to search engines and moves nobody. The redirect moves everyone.

What goes wrong

The links name the wrong site after a move. WordPress builds each one from the permalink, which starts with the "Site Address (URL)" under Settings, then General. Google's site-move guidance is that every new address should carry a canonical link to itself. Check a few pages after you change your WordPress URL or move to a new domain.

A link is used where a redirect is needed. A canonical link leaves the old address working and visitors on it. When a page has moved, redirect it. How to migrate a website without losing SEO covers which to use.

The signals disagree. Google says not to name one address in the sitemap and another in the link, and to link within your site to the canonical address. The specification says not to point the link at an address that itself redirects permanently.

Google picks another address. Because the link is a hint, it can. Google says "Duplicate without user-selected canonical" is not an error: one address was chosen and the others are left out of results, as intended.

How to look at yours

This prints the link, if the page has one:

bash
curl -s https://example.com/sample-page/ | grep -i 'rel="canonical"'

Common questions

Do I need to add a canonical tag in WordPress?

Usually not. WordPress adds one to single posts and pages by itself. Google says none of the ways to state a canonical are required, and that a site will likely do fine without one.

Is a canonical tag the same as a 301 redirect?

No. A redirect sends every visitor and crawler to the new address. A canonical tag leaves both addresses working and only tells search engines which you prefer.

Why does Google show a different address from my canonical?

Google treats the tag as one signal among several, with redirects, the sitemap and whether the address is https. Inspect the address in Search Console to see which one it selected.

Not sure what is wrong?

Tell us what you see. We reply with the cause and a fixed quote, and the diagnosis is free.