Hiding the WordPress version in your source code is one step you can take to improve security, especially if you are not running the latest version of WordPress. This prevents others from knowing which version you are using and exploiting vulnerabilities associated with it.
How to Hide the WordPress Version in the Source Code
For this method, you need to add code to the file function.php in your active theme. However, because that is less effective, you can use the plugin WPCode, so make sure the plugin is installed if you want to follow this tutorial.
1. Log in to WordPress
If you are not logged in, you can log in manually at yourwebsite/wp-login.php, or you can log in directly via WordPress Manager in cPanel if you are using cPanel.
2. Create a New Snippet to Hide the WordPress Version in the Source Code
Make sure you have installed the plugin WPCode. Once it is installed and active, you can add a snippet from the menu Code Snippets > Add Snippet
After you are on the Snippets page, select the option Add Your Custom Code
When choosing the snippet type, make sure you select PHP Snippet
3. Add Code to Hide the WordPress Version in the Source Code
Now you can add a snippet to hide the WordPress version in the source code using the following lines, then save it
remove_action( 'wp_head', 'wp_generator' );Before saving, make sure to add a name and activate the snippet
4. Check the Source Code
Now you can check the source code by accessing your website, then clicking the button CTRL + U to inspect the source code.
When in the source code, you can check for the WordPress version by searching for generator and if the snippet you used is correct, the source code will no longer display the WordPress version
If you are using a cache plugin, make sure to clear the cache after adding the snippet so the latest code is loaded.
COMMENTS
Loading...