Wrong Canonical URL From Yoast Plugin
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.
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…
Building a high performing WordPress site for your business is a bit more involved than many understand. On one hand it’s relatively easy to get started with, but on the other, it’s a complex piece of installed software that has been in development by a large open source community for more than 15 years. I’ve…
When starting with a new client on their website, one issue I frequently encounter is the lack of deployment environments. Often times there is only one consumer facing website instance deployed as a production environment. Many times there is no system of formal backups in place and these conditions serve as a recipe for disaster…
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…
Southern Cleaning Supply is a janitorial supply company based out of Panama City FL. They provide cleaning supplies and equipment to local businesses, nonprofits, and government organizations in Panama City and surrounding areas. Southern Cleaning Supply has been in business for over 30 years but experienced an ownership change in 2018. Shortly thereafter, new management…
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…
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…
I recently gave a talk at the WP Jax Meetup group on the WordPress Architecture for Beginners. This is a group I’ve been going to for about 9 months and have helped many people with WordPress related questions. Throughout that time I’ve noticed a ton of people tend to get really overwhelmed by files and…
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 through long term organic growth using content marketing and search engine optimization (SEO) and short term Pay Per Click…
Site speed is becoming a critical factor in the success of a business 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. In this article I will discuss the importance of page speed,…