Skip to main content

remove version number in WordPress

To remove the WordPress version number, primarily for security and aesthetic reasons, you can implement one of the following methods:
1. Using Code in your Theme's functions.php file:
This method involves adding code snippets to your active theme's functions.php file. Remove from Header and RSS Feeds.
Code
    remove_action('wp_head', 'wp_generator');
    add_filter('the_generator', '__return_empty_string');
  • Remove from Scripts and Styles (CSS/JS files):
Code
    function remove_version_from_scripts_styles($src) {
        if (strpos($src, 'ver=')) {
            $src = remove_query_arg('ver', $src);
        }
        return $src;
    }
    add_filter('style_loader_src', 'remove_version_from_scripts_styles', 9999);
    add_filter('script_loader_src', 'remove_version_from_scripts_styles', 9999);
Steps to implement:
  • Access your WordPress Dashboard.
  • Navigate to Appearance > Theme File Editor.
  • Select your active theme and open the functions.php file.
  • Add the desired code snippets to the end of the file.
  • Click Update File to save your changes.
2. Using a Plugin:
Several plugins are designed to easily remove the WordPress version number without manual coding.
  • Security Plugins: 
    Many security plugins like Sucuri Security include an option to hide the WordPress version number as part of their hardening features.
  • Dedicated Plugins: 
    Plugins like "Remove Version Info" or "Meta Generator and Version Info Remover" are specifically designed for this purpose.
Steps to implement (using a plugin):
  • Access your WordPress Dashboard.
  • Navigate to Plugins > Add New.
  • Search for a suitable plugin (e.g., "Remove Version Info").
  • Install and activate the chosen plugin.
  • Follow the plugin's instructions to configure and hide the WordPress version number. This often involves a simple toggle or checkbox in the plugin's settings.
Verification:
After implementing either method, clear any caching and then view your website's source code (typically by right-clicking on the page and selecting "View Page Source" or using Ctrl+U/Cmd+U). Search for "WordPress" or "ver=" to confirm that the version number is no longer present in the meta generator tag or in the query strings of your CSS and JS files.