Press "Enter" to skip to content

Yoast SEO Custom Analysis Filter has been removed

Yoast SEO is a very popular WordPress SEO plugin that I use on many of the sites I develop. Recently I’ve become aware that one of the filters I use in my functions.php file has been completely removed from the plugin, which breaks any site that it is used on. Luckily there is a fix.

The filter is “wpseo_pre_analysis_post_content”. I’ve used it mainly to add ACF fields to the SEO analysis that the plugin does in the backend to let you know how the page / post is potentially going to do, SEO wise.

The solution is to remove any reference to that filter and to enqueue this a new Javascript based script like so:

The script can be found in the javascript folder of this plugin:
https://github.com/dachcom-digital/acf-yoast-seo-validation

You can also just install it as a plugin with that download as well. I like to keep my plugins to a minimum, though, so I just grabbed the relevant file. All kudos for the code goes to that dashcom gentleman.

After you get the script, just throw it in your themes js folder and it should add any ACF fields you have associated with the post / page you are on to the SEO analysis you get when the Yoast plugin is enabled.

    Leave a Reply