Wrong Canonical URL From Yoast Plugin

wrong canonical url from yoast plugin on wordpress
Home » Blog » Wrong Canonical URL From Yoast Plugin

Join Thousands Of Other Technical Founders, Innovators, And Marketing Leaders And Get The Latest Growth Insights.

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.


As of Yoast 15.2, this issue still persists.

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

Posted in: ,
Tagged: , ,

Hunter Nelson

Hunter is the founder and president of Tortoise and Hare Software, a digital marketing agency for B2B technology companies. Hunter has more than 10 years’ 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 LinkedIn for more.


  1. Rick on November 18, 2020 at 2:10 pm

    Thanks Hunter, worked like a charm. Saved me a lot of time on this!

    • Hunter Nelson on November 18, 2020 at 2:47 pm

      You’re welcome!

  2. Jake on January 25, 2021 at 12:16 pm

    Glad this post popped up. Was seeing the same problem after using search-replace and then of course when I used wp to search for the old dev link in the dB it did not pick it up either. Have used all-tables and reactivated toast plugin

    • Hunter Nelson on January 25, 2021 at 12:19 pm

      Yep, it’s a sneaky issue. I just checked it recently and it still persists in certain cases as of 01/21. I suspect it will be an ongoing battle without a change in direction on Yoast’s end. I saw they recently tried to disable re-indexing on non production environments but that’s not a sufficient fix :-/

  3. Andy Ingham on March 9, 2021 at 3:58 pm

    We encountered this issue as well. Thanks for the helpful post.

    • Hunter Nelson on March 9, 2021 at 4:04 pm

      You’re welcome, glad we could help

  4. Elijah on April 19, 2021 at 7:51 pm

    We’ve also had this issue, but unfortunately our production site has login disabled as a security measure and I can’t login to regenerate the URLs.
    Hopefully this is being addressed/fixed.

    • Hunter Nelson on April 20, 2021 at 1:56 am

      Sorry to hear that. That’s a tricky situation, but I certainly understand the need to restrict access.

  5. Mudassir on May 16, 2021 at 1:26 am

    Hello Nelson, I stumbled upon this post as I encountered the wrong canonical URLs on my blog’s posts with Yoast plugin. I understand that you recommend to use “Yoast test helper”, but I wanted to give a try to “Rank math”, so I installed it and now the issue is resolved.

    I appreciate you put this information on the Internet, otherwise people like us might get panic. Thanks and have a good day.

    • Hunter Nelson on May 16, 2021 at 12:15 pm

      Glad to hear you found an alternative solution that works for you. Switching plugins is a task that might create other problems such as written meta descriptions from Yoast not carrying over to RankMath or lost functionality when moving from Yoast to RankMath. If you are running them both at the same time, some people may also not want to install both of them at the same time for performance reasons, cyber security risks, or maintainability concerns as well. I know the original purpose of the indexable update for Yoast was for performance reasons. RankMath is most likely using dynamic canonicals instead of loading them from an indexed DB table. That may solve the immediate problem, but miss out on the whole reason for Yoast implementing the indexable feature in the first place. I approved your comment here but just want other people to be aware that this may not be the best fix for them and there’s more to it than just “install RankMath problem solved”.

  6. Maulik Dave on September 27, 2021 at 3:24 am

    I have one Issue coming on my site. I have already changed my website name but showing the old website name on google. and many times check not clearly showing sitemap in google and others search engine portal. Please help me how to fix this issuee.

    • Hunter Nelson on September 27, 2021 at 10:17 am

      It takes a few days after making a change for Google to detect changes to your site. You can speed the process up by requesting a manual re-indexing for each page you’re concerned about at the following link: Manual Index. I’m not sure what you mean about the sitemaps.

  7. Carl France on November 2, 2021 at 7:55 am

    Hunter, I found your article as I encountered the wrong canonical URLs within the portfolio on one of our clients’ websites.

    It worked a treat and resolved the issue for me so thank you so much for taking the time to put it together and sharing it with us all.

    • Hunter Nelson on November 2, 2021 at 8:40 am

      Hey Carl, you’re welcome. Glad I could help.

  8. Barny on November 21, 2021 at 3:05 pm

    Hi all. I was use non www then I changed my website to www. I did reset the migrations. When can it apply for this my website? Thanks for your help.

Leave a Comment

Up Next

Beginner’s Guide To Measuring Search Engine Performance Metrics

By Hunter Nelson | October 25, 2020

If you’re new to the world of working with an agency on your digital marketing, you may have questions on evaluating whether or not your investment is making any difference. A website is a cornerstone of digital marketing infrastructure, and a well built website will naturally attract some traffic from search engines; known as organic…

Why Is Blogging Important For Business?

By Hunter Nelson | March 18, 2020

If you’ve owned or run a business for any length of time, chances are you’ve checked out a few competitor websites and noticed everyone has the obligatory blog link at the top of their website’s navigation. Maybe you’ve clicked through a few posts, most of which weren’t particularly interesting or helpful, and chances are a…

High Bounce Rate? Digital Marketing is a Game of Inches

By Hunter Nelson | September 19, 2019

One of the first metrics people are going to look at when they start toeing the waters of web analytics is their bounce rate. If you’re just getting started on your journey to building an inbound pipeline chances are you’re suffering from high bounce rate and your trying to bring it down. In this article…

What is Inbound Marketing?

By Hunter Nelson | June 12, 2019

Inbound marketing is the process of designing a marketing strategy that results in customers coming to you to do business. This is in stark contrast to outbound techniques which rely on you or a sales team reaching out to prospects to educate them about your services. Most business owners are familiar with outbound tactics such…

Search Marketing, Organic or Paid For Your SaaS?

By Hunter Nelson | March 18, 2019

Nothing embodies the metaphor of the Tortoise and the Hare better than the relationship between SEM, SEO and PPC. Search engine marketing (SEM) is the practice of developing a market for search traffic to your website. Content marketing builds long term organic growth using content and is often paired with search engine optimization (SEO). Short…

Site Speed as a Competitive Advantage

By Hunter Nelson | February 18, 2019

Site speed is becoming a critical factor in the success of a marketing website. It has become the most important ranking factor for SEO, is strongly correlated to bounce rate, and is one of the most important user experience factors on mobile devices. If you want to reduce your bounce rates, increase engagement with the…

Integrated Digital Marketing

By Hunter Nelson | November 25, 2018

What is Integrated Digital Marketing? What’s an Appropriate Budget? Overview of Services Provided Website Design Website Development Content Marketing Search Engine Optimization Search Engine Marketing Conversion Optimization Social Media Reputation Management Graphic Design Advertising Value of Integrated Digital Marketing Approach What is Integrated Digital Marketing? Integrated digital marketing is the merging of various digital sub-disciplines…