Skip to content

Instantly share code, notes, and snippets.

@knolaust
Last active January 30, 2024 14:48
Show Gist options
  • Save knolaust/4b133228082f5de4b5864d60150deccb to your computer and use it in GitHub Desktop.
Save knolaust/4b133228082f5de4b5864d60150deccb to your computer and use it in GitHub Desktop.
Remove WordPress Version Number
<?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');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment