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:
- Access your WordPress installation files using FTP or a file manager in your hosting control panel.
- Locate the
functions.php
the file of your active theme, usually found in thewp-content/themes/your-theme-name/
directory. - Open the
functions.php
file in a text editor. - Add the following code snippet at the end of the file:
function wpr_remove_version() { return ' '; } add_filter('the_generator', 'wpr_remove_version');
- 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:
- Create a new PHP file called
remove-wp-version.php
using a text editor. - 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');
- Save the file.
- Upload the
remove-wp-version.php
file to thewp-content/plugins/
directory of your WordPress installation using FTP or a file manager. - Log in to your WordPress admin dashboard.
- Go to the “Plugins” page.
- 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.