How to Remove Yoast SEO HTML Comments?

Simply copy and paste this code at the bottom of your theme’s functions.php file:

// Remove Yoast SEO comments from html by SEODOX

add_filter('wpseo_debug_markers', '__return_false');

This code will remove Yoast SEO plugin comments from html such as:

<!– This site is optimized with the Yoast SEO plugin v22.4 – –>

<!– / Yoast SEO plugin. –>