How to remove Yoast SEO WP plugin debug message

Yoast WordPress SEO Plugin is very popular WordPress plugin, but it comes with couple of annoying modifications.
One of them is this extra debug message added into the source code:

<!-- This site is optimized with the Yoast WordPress SEO plugin v1.5.3.3 - https://yoast.com/wordpress/plugins/seo/ -->

Everywhere on internet people advice you to edit plugin source code to get rid of it.
Don’t do it! Your “fix” will not work when you update the plugin.

Instead od that, add this into your functions.php:


add_action('init', 'remove_yoast_debug');
function remove_yoast_debug() {
    remove_action( 'wpseo_head', array( $GLOBALS['wpseo_front'], 'debug_marker' ), 2 );
}

In short, this detach Yoast function responsible for debug message.
And it will work even after Yoast update, well unless they rename the function, the class or unless they change the priority, but thats unlikely.

Leave a Reply