Skip to content

Instantly share code, notes, and snippets.

@almone
Forked from paulcollett/functions.php
Created February 11, 2016 20:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save almone/6c9677ca4ee835e48188 to your computer and use it in GitHub Desktop.
Save almone/6c9677ca4ee835e48188 to your computer and use it in GitHub Desktop.
Remove Yoast HTML Comments “This site is optimized with the Yoast WordPress SEO plugin”
// Add to your Wordpress Theme's functions.php
// 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