Wrong Canonical URL From Yoast Plugin

If Yoast is showing your development or staging domain in the live site’s canonical URLs, reset its indexables and run SEO data optimization again. This rebuilds Yoast’s stored SEO data using your live site’s URLs.
I ran into this while checking Google Search Console after a drop in rankings. Both the canonical URLs and Open Graph tags pointed to my local development domain, even though the site was live. After several talks with my host and a few more site launches, I traced the problem to old URLs stored in Yoast’s indexables.
Why Yoast Shows The Wrong Canonical URL
Yoast introduced indexables in version 14.0 to store SEO data in its own database tables. These include a table such as YOURWPPREFIX_yoast_indexable. Instead of building all that data for each page view, Yoast reads it from the tables.
In my case, the WP-CLI search-replace command used during the site move missed Yoast’s table. By default, the command updates tables registered to the $wpdb object. Yoast’s indexables table fell outside that selection, leaving the development domain in its stored SEO data even though WordPress had the live domain.
WP-CLI can include additional tables: --all-tables-with-prefix includes tables with the site’s prefix, while --all-tables includes every table in the database. For this issue, I recommend rebuilding Yoast’s indexables directly rather than running another broad search and replace on production.
If you use separate WordPress deployment environments, include Yoast’s tables in the URL updates when moving a site to production.
How To Fix The Wrong Canonical URL In Yoast
On your live production site, use the Yoast Test Helper plugin to reset the old data, then let Yoast rebuild it. Take a database backup before the reset.
- Install and activate Yoast Test Helper.
- Go to Tools > Yoast Test in WordPress Admin.
- Under Yoast SEO, click Reset indexables tables & migrations.

Next, go to Yoast SEO > Tools and click Start data optimization. Let the process finish so Yoast can rebuild its indexables.

Yoast will regenerate its stored data, correcting the stale domain in both canonical URLs and Open Graph tags. Clear your site cache, then view a live page’s source and search for rel="canonical" to confirm it uses the live domain.
If a later staging-to-production push copies the old Yoast data again, repeat the reset after that push. Updating the deployment process to include Yoast’s tables prevents the same problem from returning.
Need help fixing SEO issues on your WordPress site? Book a free technical SEO consultation.