Created
May 31, 2018 11:45
-
-
Save bigdigital/d1b17aaa69564b066af0e5702e45e876 to your computer and use it in GitHub Desktop.
Wordpress remove all meta generators
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 All Meta Generators | |
function remove_meta_generators($html) { | |
$pattern = '/<meta name(.*)=(.*)"generator"(.*)>/i'; | |
$html = preg_replace($pattern, '', $html); | |
return $html; | |
} | |
function clean_meta_generators($html) { | |
ob_start('remove_meta_generators'); | |
} | |
add_action('get_header', 'clean_meta_generators', 100); | |
add_action('wp_footer', function(){ ob_end_flush(); }, 100); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment