Remove “Generator” Tags

Don’t want those “generator” tags in your source? Add this

remove_action( 'wp_head', 'wp_generator' );

To modify the output, you can run in through a filter. In this case, the modification is removal.

add_filter('the_generator', 'remove_generated_by');
function remove_generated_by($footer_text) {
    return '';
}

If you want to be more specific about where the generator tags are are removed, you can change the filter to something like on of these

add_filter('get_the_generator_xhtml', 'remove_generated_by');

Just swap ‘xhtml’ for one of the following as needed: html, xhtml, atom, rss2, rdf, comment, export.

Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: