Snippets Library

Remove / Hide WordPress Version Number

Posted by Editorial Staff

To remove or remove the WordPress version number from your website, you can add a small code snippet to your theme’s `functions.php` file or create a custom functionality plugin. Here’s the process:

  1. Access your WordPress installation files using FTP or a file manager in your hosting control panel.
  2. Locate the functions.php the file of your active theme, usually found in the wp-content/themes/your-theme-name/ directory.
  3. Open the functions.php file in a text editor.
  4. Add the following code snippet at the end of the file:
function wpr_remove_version() {
return ' ';
}
add_filter('the_generator', 'wpr_remove_version');
  1. Save the changes and upload the modified functions.php file back to your WordPress installation, overwriting the existing file if necessary.

By adding this code, you are hooking into the `the_generator` filter and returning an empty string, effectively removing the WordPress version number from your website’s HTML output.

Remove WordPress Version Number with Plugin

Alternatively, if you prefer to use a custom functionality plugin instead of modifying the theme files, you can follow these steps:

  1. Create a new PHP file called remove-wp-version.php using a text editor.
  2. Add the following code to the remove-wp-version.php file:
<?php
/*
Plugin Name: WPR Remove WordPress Version Number
Description: WPR Removes the WordPress version number from the website's HTML output.
*/
function wpr_remove_version() {
return ' ';
}
add_filter('the_generator', 'wpr_remove_version');
    1. Save the file.
    2. Upload the remove-wp-version.php file to the wp-content/plugins/ directory of your WordPress installation using FTP or a file manager.
    3. Log in to your WordPress admin dashboard.
    4. Go to the “Plugins” page.
    5. You should see the “Remove WordPress Version Number” plugin listed. Click “Activate” to enable the plugin.

Regardless of whether you choose to modify the `functions.php` file or create a custom functionality plugin, both methods will remove the WordPress version number from your website’s HTML output. This helps improve security by reducing the visibility of the WordPress version you are using.

Leave a Reply

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