Remove WordPress Version Number

01/30/2024
Back to Gists
<?php
/**
 * Removes the WordPress version number from the HTML generator tag.
 *
 * This function attaches to the 'the_generator' filter hook and replaces the 
 * default WordPress generator string with an empty string. This is often used 
 * for security purposes to obscure the WordPress version number.
 *
 * @link https://developer.wordpress.org/reference/hooks/the_generator/ WordPress Hook: the_generator
 *
 * Gist Keywords: wordpress, functions, meta
 *
 * @author Knol Aust
 */
add_filter('the_generator', '__return_empty_string');