Yoast ignoring your setting? Check where you’re working

A quick tip for anyone working on a local copy of a site.

Cover: Local is not live

I set a page to “don’t let search engines find this” (noindex). It disappeared from the sitemap right away, but the page itself kept saying: findable. Saving again didn’t help. On another page, the same setting worked in one go.

Yoast keeps its own summary of the SEO data for each page, and only updates it on a live site. On a local development environment Yoast refuses to, on purpose. A page that didn’t have such a summary yet simply uses the setting. But a page with a summary from the time the site was still live keeps showing the old value. And after copying a live site to your own computer, almost every page has such an old summary.

What you can do with this

In doubt on your local copy whether an SEO setting works? Know that Yoast may be showing you an outdated picture there. On the live site it just works.

For the techies

Tested with: Yoast SEO on WordPress 7.1.2, Local, WP_ENVIRONMENT_TYPE = local, after a Duplicator import.

Yoast’s indexables (wp_yoast_indexable) are only built and updated on production:

$ wp yoast index --reindex
Your WordPress environment is running on a non-production site. Indexables can only be created on production environments. Please check your `WP_ENVIRONMENT_TYPE` settings.

If a record exists, it wins over the post meta _yoast_wpseo_meta-robots-noindex. Without a record, Yoast reads the meta directly.

Fix on Local: delete only the outdated record, through Yoast’s own repository and not with SQL:

wp eval '$r = YoastSEO()->classes->get( \Yoast\WP\SEO\Repositories\Indexable_Repository::class );
$r->find_by_id_and_type( 1552, "post", false )->delete();'

After that the page shows noindex. On live, simply saving is enough.