-
-
Save despecial/6bfff5920dc2002f56a3a08f51ea6d16 to your computer and use it in GitHub Desktop.
Remove Yoast HTML Comments “This site is optimized with the Yoast WordPress SEO plugin”
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
/* add to functions.php in theme folder */ | |
// Remove All Yoast HTML Comments | |
// https://gist.github.com/paulcollett/4c81c4f6eb85334ba076 | |
if (defined('WPSEO_VERSION')){ | |
add_action('get_header',function (){ ob_start(function ($o){ | |
return preg_replace('/\n?<.*?yoast.*?>/mi','',$o); }); }); | |
add_action('wp_head',function (){ ob_end_flush(); }, 999); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment