Wrong Canonical URL From Yoast Plugin
Published: September 23, 2020
Last Updated: February 11, 2021
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.
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.
- First off install the Yoast Test Helper Plugin
- From WP Admin go to tools > Yoast Test
- Click on the reset indexables tables & migrations button
- Go to the yoast plugin tools by clicking SEO > tools
- Click the “start processsing and speed up your site now button”
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.
Free Email Course:
Launching Your B2B Digital Marketing Program
Enroll in our free digital lead generation crash course. A 60 day email series with twice a week emails walking through the journey of how to launch your digital marketing program and generate more B2B leads from your website. Unsubscribe at any time.
In this guide we’re going to talk about how you can use MSP marketing to generate enough pipeline to get to 5 million plus in annual recurring revenue. A lot of the things we’ll talk about in this guide can be used in larger and smaller businesses but for the purposes of this guide we’ll…
In today’s post, we’re going to be talking about a common PPC machine learning algorithm of which some variant is leveraged in part by many pay per click platforms called a multi arm bandit. We’ll talk about how they compare to simple A/B tests and why understanding the types of algorithms these platforms use is…
According to industry research by a leading managed service provider marketing firm, 94% of MSPs self-reported lead generation as their number one challenge when it comes to growing their MSP. There’s no question that the vast majority of MSPs struggle with lead generation, especially in the earlier years of their business. It makes sense, most…
Throughout the process of launching and running Tortoise and Hare Software these past 3-4 years there’s one thing that I’ve gotten consistently good feedback on. The brand! People who aren’t shopping for marketing, and have no relationship to the company will regularly come up to me at trade shows, or comment on my business card,…
Generating leads for your MSP can be a challenge. You spend so much time managing employees, making sure customer support tickets are answered, procuring hardware, and defending against cyber threats, there’s hardly time to worry about networking and doing things like posting on social media. However, you’d like to grow faster, and due to some…
Search Engine Optimization (SEO) is one of the most important ways to attract new business for mid-market managed service providers (MSP). If you look at MSPs that have achieved any sort of meaningful scale and grown to the 10MM ARR mark and beyond, you will almost always see a significant portion of their growth came…
Tortoise and Hare Software is a boutique B2B tech marketing agency. We help companies like MSPs, SaaS providers, cybersecurity firms, and other technology service providers launch their digital marketing programs and generate inbound leads.