{"id":627,"date":"2025-06-16T09:35:14","date_gmt":"2025-06-16T07:35:14","guid":{"rendered":"https:\/\/wpcodebox.com\/?post_type=tutorial&#038;p=627"},"modified":"2025-12-15T17:26:11","modified_gmt":"2025-12-15T16:26:11","slug":"remove-wordpress-version-number","status":"publish","type":"tutorial","link":"https:\/\/wpcodebox.com\/tutorial\/remove-wordpress-version-number\/","title":{"rendered":"Remove the WordPress Version Number with One Simple Code Snippet!"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">By default, WordPress shares the exact version number in your site&#8217;s source code. If you are on a version known to have a vulnerability, attackers can exploit it to compromise your site.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In this article, I&#8217;ll share with you how to remove the WordPress version number from all visible locations.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Why You Should Remove the WordPress Version Number<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Your WordPress version number publicly reveals which release your site runs. For example, when security researchers disclose an exploit for a specific version of WordPress, automated tools immediately search for sites running that exact version. The visible WordPress version tag on your website acts as a beacon, telling attackers your site is potentially vulnerable.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This creates a dangerous window of exposure between patch release and your update. Even a day of delay gives scanners time to find and compromise your installation.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Where Does WordPress Expose Your Version?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Your WordPress version appears in three primary locations across your site.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The HTML head section displays a generator meta tag. WordPress automatically outputs &lt;meta name=&#8221;generator&#8221; content=&#8221;WordPress X.X.X&#8221; \/&gt; in your source code. Most automated scanners check this first.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/wpcodebox.com\/wp-content\/uploads\/2025\/06\/wordpress-version-visible-in-source-code-1024x296.png\" data-rel=\"lightbox-image-0\" title=\"\" class=\"swipebox\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"296\" src=\"https:\/\/wpcodebox.com\/wp-content\/uploads\/2025\/06\/wordpress-version-visible-in-source-code-1024x296.png\" alt=\"wordpress version visible in source code\" class=\"wp-image-1627\" srcset=\"https:\/\/wpcodebox.com\/wp-content\/uploads\/2025\/06\/wordpress-version-visible-in-source-code-1024x296.png 1024w, https:\/\/wpcodebox.com\/wp-content\/uploads\/2025\/06\/wordpress-version-visible-in-source-code-300x87.png 300w, https:\/\/wpcodebox.com\/wp-content\/uploads\/2025\/06\/wordpress-version-visible-in-source-code-768x222.png 768w, https:\/\/wpcodebox.com\/wp-content\/uploads\/2025\/06\/wordpress-version-visible-in-source-code.png 1200w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">RSS feeds include the version number in their metadata. The same generator tag that appears in your header also outputs in feeds, creating another exposure point.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/wpcodebox.com\/wp-content\/uploads\/2025\/06\/wordpress-version-number-in-rss-feed-1024x253.png\" data-rel=\"lightbox-image-1\" title=\"\" class=\"swipebox\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"253\" src=\"https:\/\/wpcodebox.com\/wp-content\/uploads\/2025\/06\/wordpress-version-number-in-rss-feed-1024x253.png\" alt=\"wordpress version number in rss feed\" class=\"wp-image-1629\" srcset=\"https:\/\/wpcodebox.com\/wp-content\/uploads\/2025\/06\/wordpress-version-number-in-rss-feed-1024x253.png 1024w, https:\/\/wpcodebox.com\/wp-content\/uploads\/2025\/06\/wordpress-version-number-in-rss-feed-300x74.png 300w, https:\/\/wpcodebox.com\/wp-content\/uploads\/2025\/06\/wordpress-version-number-in-rss-feed-768x189.png 768w, https:\/\/wpcodebox.com\/wp-content\/uploads\/2025\/06\/wordpress-version-number-in-rss-feed.png 1200w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">CSS and JavaScript files reveal the version through query strings. Your source code shows files like style.css?ver=X.X.X. Attackers inspect these parameters to fingerprint your exact WordPress release.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/wpcodebox.com\/wp-content\/uploads\/2025\/06\/worpress-version-number-in-stylesheet-1024x256.png\" data-rel=\"lightbox-image-2\" title=\"\" class=\"swipebox\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"256\" src=\"https:\/\/wpcodebox.com\/wp-content\/uploads\/2025\/06\/worpress-version-number-in-stylesheet-1024x256.png\" alt=\"worpress version number in stylesheet\" class=\"wp-image-1628\" srcset=\"https:\/\/wpcodebox.com\/wp-content\/uploads\/2025\/06\/worpress-version-number-in-stylesheet-1024x256.png 1024w, https:\/\/wpcodebox.com\/wp-content\/uploads\/2025\/06\/worpress-version-number-in-stylesheet-300x75.png 300w, https:\/\/wpcodebox.com\/wp-content\/uploads\/2025\/06\/worpress-version-number-in-stylesheet-768x192.png 768w, https:\/\/wpcodebox.com\/wp-content\/uploads\/2025\/06\/worpress-version-number-in-stylesheet.png 1200w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Each location gives attackers a way to identify your installation and carry out attacks.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">How to Remove WordPress Version Number<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Basic solutions only remove the header generator tag. This leaves your version exposed in RSS feeds and asset URLs. You need a comprehensive approach that addresses all three locations simultaneously.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This code snippet removes the WordPress version from all public locations. It hides the generator tag in headers and RSS feeds. It also strips version numbers from CSS and JavaScript file queries.<\/p>\n\n\n\n<div class=\"wp-block-wpcodebox-snippet wpcodebox-snippet\" data-language=\"php\"><pre class=\"line-numbers\"><code class=\"language-php\">&lt;?php\n\nadd_filter('the_generator','__return_empty_string');\n\nfunction remove_version_from_assets($src) {\n    $wp_version = get_bloginfo('version');\n\n    if(strpos($src,'ver='.$wp_version) !== false) {\n        $src = remove_query_arg('ver',$src);\n    }\n\n    return $src;\n}\nadd_filter('style_loader_src','remove_version_from_assets',9999); \nadd_filter('script_loader_src','remove_version_from_assets',9999);<\/code><\/pre><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">The first line uses a WordPress helper function to return an empty string for all generator tags. The second function specifically targets version parameters matching your current WordPress release. It leaves other query strings intact to avoid breaking cache-busting strategies for custom themes and plugins. The 9999 priority ensures this filter runs after most other processes, catching all cases.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Both filters work together to provide complete coverage. When automated scanners look for generator tags, they\u2019ll find nothing. Tools inspecting your asset URLs will see query strings without version data.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Step-by-Step: Add This Code Snippet to Your WordPress Website<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Editing theme files directly creates long-term problems. Theme updates can overwrite your custom code and force you to reapply changes. A syntax error can lock you out of your admin area completely. A better solution is to use a code snippet plugin.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/wpcodebox.com\/pricing\/\" data-type=\"page\" data-id=\"131\" target=\"_blank\" rel=\"noreferrer noopener\">WPCodeBox<\/a> eliminates these risks by running your code snippets independently of your theme. The plugin isolates custom code in a protected environment with built-in error handling that prevents most mistakes from breaking your site. Your modifications stay active across theme changes and updates without manual intervention.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/wpcodebox.com\/wp-content\/uploads\/2025\/12\/wpcodebox-snippet-plugin-1024x588.png\" data-rel=\"lightbox-image-3\" title=\"\" class=\"swipebox\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"588\" src=\"https:\/\/wpcodebox.com\/wp-content\/uploads\/2025\/12\/wpcodebox-snippet-plugin-1024x588.png\" alt=\"wpcodebox snippet plugin\" class=\"wp-image-1606\" srcset=\"https:\/\/wpcodebox.com\/wp-content\/uploads\/2025\/12\/wpcodebox-snippet-plugin-1024x588.png 1024w, https:\/\/wpcodebox.com\/wp-content\/uploads\/2025\/12\/wpcodebox-snippet-plugin-300x172.png 300w, https:\/\/wpcodebox.com\/wp-content\/uploads\/2025\/12\/wpcodebox-snippet-plugin-768x441.png 768w, https:\/\/wpcodebox.com\/wp-content\/uploads\/2025\/12\/wpcodebox-snippet-plugin.png 1200w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">The plugin also provides a library of verified snippets you can add with one click, plus cloud sync to reuse your solutions across all your WordPress sites. You manage all PHP, CSS, and JavaScript snippets from an organized dashboard that keeps your code portable and maintenance-free.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Let\u2019s now look at how to use it to hide the WordPress version:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Start by purchasing and installing WPCodeBox on your site. Once activated, navigate to WPCodeBox from your admin menu.<\/li>\n\n\n\n<li>This automatically opens a new snippet creation window. Name your snippet &#8220;Remove WordPress Version Number&#8221; for easy reference. You can also add a brief description if you want.<\/li>\n\n\n\n<li>Paste the complete PHP code from the previous section into the code editor.<\/li>\n\n\n\n<li>Configure these settings in the snippet panel:\n<ul class=\"wp-block-list\">\n<li><strong>Type:<\/strong>&nbsp;PHP Snippet<\/li>\n\n\n\n<li><strong>How to run the snippet:<\/strong>&nbsp;Always (On Page Load)<\/li>\n\n\n\n<li><strong>Where to insert the snippet:<\/strong>&nbsp;Plugins Loaded (Default)<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>Click the Save button above the editor. WPCodeBox saves your snippet in a disabled state to protect your site.<\/li>\n\n\n\n<li>Review your code to ensure no characters were lost during copying.<\/li>\n\n\n\n<li>Toggle the snippet to Enabled status to activate version removal across your site.<\/li>\n\n\n\n<li>Clear your site cache if you use a caching plugin to see immediate results.<\/li>\n<\/ol>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/wpcodebox.com\/wp-content\/uploads\/2025\/06\/remove-wordpress-version-code-snippet-1024x632.png\" data-rel=\"lightbox-image-4\" title=\"\" class=\"swipebox\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"632\" src=\"https:\/\/wpcodebox.com\/wp-content\/uploads\/2025\/06\/remove-wordpress-version-code-snippet-1024x632.png\" alt=\"remove wordpress version code snippet\" class=\"wp-image-1630\" srcset=\"https:\/\/wpcodebox.com\/wp-content\/uploads\/2025\/06\/remove-wordpress-version-code-snippet-1024x632.png 1024w, https:\/\/wpcodebox.com\/wp-content\/uploads\/2025\/06\/remove-wordpress-version-code-snippet-300x185.png 300w, https:\/\/wpcodebox.com\/wp-content\/uploads\/2025\/06\/remove-wordpress-version-code-snippet-768x474.png 768w, https:\/\/wpcodebox.com\/wp-content\/uploads\/2025\/06\/remove-wordpress-version-code-snippet.png 1200w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Your version number removal is now active across your entire site. WPCodeBox protects this code from theme updates and makes future modifications effortless. The changes apply immediately without touching a single theme file.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Verify the WordPress Version Number is Gone<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">In order to verify the changes, you should first check your source code. Open any page on your site and press Ctrl+U (or Cmd+Option+U on Mac). Search for &#8220;generator&#8221; in the code. The WordPress version meta tag should be completely absent.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">You can also inspect your CSS and JavaScript files next. View the source and locate any stylesheet or script URLs. They should no longer include ver=X.X.X query strings with your WordPress version.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To test your RSS feed, you can visit \/feed\/ on your site and view the page source to confirm the generator tag is missing from the feed metadata.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">More on Removing WordPress Version Number<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>1. Should I hide my WordPress version?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Hiding your WordPress version is a recommended security precaution. While it does not fix existing vulnerabilities, it acts as a layer of hiding visible details. This prevents automated bots and attackers from easily identifying your specific version and targeting your site with exploits known to affect that release.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>2. How do I disable revisions in WordPress?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">You can disable post revisions by adding a simple code snippet to your site&#8217;s <strong>wp-config.php<\/strong> file. Open the file and add the line <code>define( 'WP_POST_REVISIONS', false );<\/code> just above the line that says &#8220;That&#8217;s all, stop editing.&#8221; This will stop WordPress from saving multiple copies of your posts and help keep your database clean. You can also use a code snippet plugin like WPCodeBox to add the code.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>3. Why is it a good security practice to hide the WordPress version number?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Hiding the version number complicates things when hackers look for targets. Hackers frequently run automated scripts to scan the internet for websites running outdated versions of WordPress with known security holes. If your version number is not visible, these scripts are less likely to flag your website as a vulnerable target.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>4. What is the best plugin to hide WordPress?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">While other plugins like WP Hide &amp; Security Enhancer offer many features, they can be overkill if you just want to hide the WordPress version number from your site&#8217;s code. For a lean and efficient solution, WPCodeBox is the best plugin. It allows you to easily add and manage the specific code snippets needed to hide your WordPress version without adding the bloat or complexity of a heavy security plugin.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">More Snippets to Customize Your WordPress Site<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/wpcodebox.com\/snippet\/disable-xml-rpc-wordpress\/\" target=\"_blank\" rel=\"noreferrer noopener\">Disable XML-RPC WordPress<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/wpcodebox.com\/snippet\/wordpress-disable-rest-api\/\" target=\"_blank\" rel=\"noreferrer noopener\">Disable WordPress REST API<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/wpcodebox.com\/snippet\/how-to-disable-theme-and-plugin-editors-in-wordpress\/\" target=\"_blank\" rel=\"noreferrer noopener\">How to Disable Theme and Plugin Editors in WordPress<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/wpcodebox.com\/snippet\/how-to-remove-dns-prefetch-from-wordpress-head-to-improve-performance\/\" target=\"_blank\" rel=\"noreferrer noopener\">How to Remove DNS Prefetch from WordPress Head to Improve Performance<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/wpcodebox.com\/snippet\/how-to-disable-wordpress-embeds-using-php-code\/\" target=\"_blank\" rel=\"noreferrer noopener\">How to Disable WordPress Embeds Using PHP Code<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/wpcodebox.com\/snippet\/remove-wordpress-admin-bar\/\" target=\"_blank\" rel=\"noreferrer noopener\">Remove WordPress Admin Bar<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Learn how to hide your WordPress site version number using WPCodeBox and a simple snippet!<\/p>\n","protected":false},"featured_media":628,"template":"","meta":{"_acf_changed":false},"tutorial-category":[8],"class_list":["post-627","tutorial","type-tutorial","status-publish","has-post-thumbnail","hentry","tutorial-category-how-to"],"acf":[],"_links":{"self":[{"href":"https:\/\/wpcodebox.com\/wp-json\/wp\/v2\/tutorial\/627","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wpcodebox.com\/wp-json\/wp\/v2\/tutorial"}],"about":[{"href":"https:\/\/wpcodebox.com\/wp-json\/wp\/v2\/types\/tutorial"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/wpcodebox.com\/wp-json\/wp\/v2\/media\/628"}],"wp:attachment":[{"href":"https:\/\/wpcodebox.com\/wp-json\/wp\/v2\/media?parent=627"}],"wp:term":[{"taxonomy":"tutorial-category","embeddable":true,"href":"https:\/\/wpcodebox.com\/wp-json\/wp\/v2\/tutorial-category?post=627"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}