-
-
Save dexit/679110c6c08196a2fb43b52f2545d725 to your computer and use it in GitHub Desktop.
Remove Yoast HTML Comments “This site is optimized with the Yoast WordPress SEO plugin” with Yoast v11
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Remove Yoast HTML Comments | |
//https://gist.github.com/robwent/f36e97fdd648a40775379a86bd97b332 | |
function go_yoast() { | |
if (defined('WPSEO_VERSION')){ | |
add_action('get_header',function (){ ob_start(function ($o){ | |
return preg_replace('/\n?<.*?Yoast SEO plugin.*?>/mi','',$o); }); }); | |
add_action('wp_head',function (){ ob_end_flush(); }, 999); | |
} | |
} | |
add_action('plugins_loaded', 'go_yoast'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment