Wrong Canonical URL From Yoast Plugin

wrong canonical url from yoast plugin on wordpress

The other day I was reviewing some indexed pages in Google Search console trying to understand why I was having a drop in rankings and noticed that I had both canoncial URLs and Open Graph tags indexed in Google that were pointing to my local development machines URL. WTF? I knew that the Yoast Plugin was responsible for outputting this information dynamically so I started to do some digging in how this was happening and why there was the wrong canonical URL from Yoast.

After much back and forth with my hosting provider and multiple publishes of my website with the issue resurfacing I was able to pinpoint the cause of the issue relating to the recent release of their “indexables” feature in 14.0.

Yoast Indexables

For those who don’t know the indexables feature means that now much of the SEO meta data for a given page is stored in a table in the database, the YOURWPPREFIX_yoast_indexable table. This is meant to speed up the process of retrieving SEO meta data and prevent dynamic pulls in PHP from slowing down page load speeds.

Unfortunately this table is not registered on the $wpdb object. Many hosting providers, including the one leveraged by Tortoise and Hare Software will use a wp search-replace CLI command internally when pushing sites from one environment to another, e.g. staging to production, to update the sites URL from the current domain to the destination domain.

If you look at the wp search-replace command documentation you’ll see that the base command will only run on tables included in the $wpdb object which does not include the yoast_indexable table! This command would have to be run with an –all-tables flag to include the yoast indexables tables and that may not be feasible for all hosting providers as this can update more than one instance of WordPress if there are multiple instances stored on the same server.

I’m not sure if this was an oversight or not on the part of the yoast team or if that was intentional. Either way, the problem will likely persist on hosting providers for the time being and in the meantime more than a few sites are likely publishing out bad canonicals and other references to 404’d or private domains.

Wrong Canonical URL From Yoast Plugin Workaround

The best and least invasive workaround at this time is for you to reset the yoast indexables from your production environment. This option is much safer than running a search replace command on production.

Reset Yoast Indexables

This is the option I recommend for fixing the issue of wrong canonical URLs from yoast. It’s the safest option and works great.

  1. First off install the Yoast Test Helper Plugin
  2. From WP Admin go to tools > Yoast Test
  3. Click on the reset indexables tables & migrations button
  4. Go to the yoast plugin tools by clicking SEO > tools
  5. Click the “start processsing and speed up your site now button”
    increase site speed button yoast indexables

That’s it your done. Yoast will regenerate the database tables and your canonicals and open graph tags should be working again with the correct domain name in your URL. Please note that you will have to go through this exercise every time you push from a lower environment to production.

I’m sure the Yoast team is going to be flooded with support requests about this issue and hopefully they will roll out a fix in the coming months that allows the plugin to play nicer with hosting providers. Until then you can use this workaround for the wrong canonical URL from Yoast to repair your SEO on WordPress.

Update:

As of Yoast 15.2, this issue still persists.

Questions, thoughts? Drop a comment below and get the discussion started.

About The Author

Hunter Nelson

Hunter is the founder and president of Tortoise and Hare Software, a digital marketing agency for the technology sector. Hunter holds a bachelor's in Information Technology and a Master's in Business Administration from Florida State University and has more than 15 years’ of experience building web applications and crafting digital strategies for companies ranging from scrappy startups to Fortune 50 household names. When not on the clock, you'll find him spending time with his family and pups, relaxing on the beach, or playing competitive online video games. See for more.

Share This Post

Post Meta

Table Of Contents

Recent Posts

Featured Review

testimonial

Tortoise and Hare has been a key partner in our MSP's growth. Over the year's we've worked together they've helped our MSP dramatically increase our website traffic, and build a steady stream of leads sourced from our website and advertising efforts. Over that time, we've been able to raise our base customer size, build economies of scale to more efficiently service customers, and expand into new markets.

R.D.
President Regional MSP

Thank You For Visiting
The Tortoise and Hare Software Website

You are here:
Home » Blog » Wrong Canonical URL From Yoast Plugin

Visit Us On Social Media

Subscribe To Our Newsletter

The latest marketing thought leadership for mid-market B2B technology firms.

More About Our Digital Marketing Agency

Browse Our Key Digital Marketing Services

Policies and Terms

© 2018-2026 Tortoise and Hare Software LLC. All Rights Reserved.
This site content may not be copied, reproduced, or redistributed without the prior written permission of Tortoise and Hare Software or its affiliates.