Canonical URLs in Yoast SEO

Table of Contents

How to Change the Canonical
Canonical Elements For Paginated Archives
Developer Code
Compatibility with Rel/Next Tags
Troubleshooting


How to Change the Canonical

Yoast SEO (free or premium) adds canonical URLs to your WordPress install for all content that is marked for indexing by search engines. It does this automatically and in 99.9% of cases you don't have to change anything about them.

If you do want to change them, each piece of content has a canonical field where you can enter the absolute canonical URL.

  1. Log in to your WordPress website.

    When you're logged in, you will be in your 'Dashboard'.

  2. Edit the post, page, or taxonomy.

    On the left-hand side, you will see a menu that allows you to navigate to your posts, pages, and other content. Navigate to the individual item to edit the content settings.

  3. For posts and pages, scroll down to the Yoast SEO metabox. Under the 'SEO' tab, click to expand the 'Advanced' section.

    Yoast SEO metabox with the advanced section highlighted

  4. Enter the full canonical URL, including http/s and www or non-www, in the 'Canonical URL' field.

    Yoast SEO metabox with the canonical section highlighted

  5. Update the post, page or taxonomy.

Canonical Elements For Paginated Archives

A common misconception is that the canonical on a paginated page should always point to page 1 in the series. This is not the case. When you do that, you run the risk of search engines not indexing links that appear on page 2, 3 etc. of your archives. This would cause older articles to drop out of the search results entirely.

Of course, you can change the canonical element of a category, tag or other taxonomy archives to point at another page. To do this, follow the steps above.

Developer Code

If you want, you can also filter the output of the canonical programmatically. To do this you can use the wpseo_canonical filter. If you return false on that, no canonical will be output. Some examples can be found here.

If you are not sure how or where to enter the filter you may wish to use a Yoast Partner who can help.

Troubleshooting

I Do Not Have a Canonical Tag

In some cases you may not see a canonical tag being outputted on a page. If this is the case check to see if the page has a noindex tag. If it does, that is the reason why. We do not output a canonical tag if the page is marked as noindex. To resolve the issue mark the pages as index.

This guide explains more about how to remove noindex tags: How do I Noindex URLs? You may need to check in several spots.

Was this article helpful? ·