# Hide the WordPress and WooCommerce version number

URL: https://wp24x7.com/how-to-remove-version-information-from-your-wordpress/
Updated: 2026-11-29
Type: blog post
Audience: WordPress site owners and developers

> By default WordPress prints its version in your page source and WooCommerce adds its own. Remove them with two lines in a child theme or small plugin, then block readme and license files at the server, but treat this as housekeeping: a version number only helps attackers when it is old, so updating matters far more than hiding. Confirm the result in the page source and feeds.

## Key facts

- For: owners and developers tidying version leaks from WordPress and WooCommerce
- Code: remove_action( 'wp_head', 'wp_generator' ) and the_generator filter
- Other leaks: ?ver= URLs, readme.html, license.txt, plugin readme.txt, feeds
- Priority: update first, hide second
- Safety: back up first; do not edit core files
- Test: page source, /feed/, /readme.html, SEO and monitoring tools
- Help: security service and maintenance service

By default WordPress prints its version in your page source, and WooCommerce adds its own. **Remove them with two lines in a child theme or small plugin, but treat that as housekeeping and keep your software updated.**

> **Update first, hide second**
A version number helps attackers only when it is old. If you can do one thing today, update. Back up before adding code, and never edit core files, which an update overwrites.

This post focuses on the version number. For tags added by other plugins, see [removing meta generator tags](/remove-meta-generator-wordpress-woocommerce-revslider-wpbakery).

## Why does the version number matter?

A version number tells a scanner which known vulnerabilities to try. If you run the latest release, that information helps nobody. If you run an old one, it helps attackers pick a target. Hiding it makes the first step slightly harder, and nothing more: scanners can still identify WordPress from file paths and behavior.

## How do I remove the WordPress and WooCommerce version?

```php
remove_action( 'wp_head', 'wp_generator' );
add_filter( 'the_generator', '__return_empty_string' );
```

The first line stops the generator meta tag in your page head. The second empties the generator string in feeds and other places WordPress prints it. Check `/feed/` as well as the page source.

WooCommerce prints its version in a generator tag, and in current releases it adds it by filtering WordPress's generator output, so the lines above should hide it too. Confirm in your own page source rather than trusting any one snippet. If a WooCommerce tag remains, search the source for `generator`, find the function that prints it and remove it with `remove_filter()` using the same hook name and priority.

## Where else does the version leak?

| Place | What shows | What to do |
|---|---|---|
| Script and style URLs | `?ver=` followed by a version | Leave alone; removing causes stale files |
| `readme.html` and `license.txt` | The core version | Delete if present; re-check after updates |
| Plugin `readme.txt` files | Plugin versions | Deny public access with a server rule |
| RSS feeds | Generator string | Covered by the filter above |
| Login page | Version on a very old install | Update |

### Apache
A web server rule is the cleanest way to block the text files:

```apache
<FilesMatch "^(readme|license)\.(html|txt)$">
	Require all denied
</FilesMatch>
```
### Nginx and managed hosts
Nginx and other servers have equivalents. Back up your configuration first. If your host manages it, ask them to deny those files, and explain exactly which. A wrong rule can take the site down.

## How do I confirm it worked?

1. **Open the home page** in a private window and view the source.
2. **Search for** `generator` and `ver=`.
3. **Open** `/feed/`, `/readme.html` and `/license.txt`.
4. **Test** an SEO plugin, uptime monitor and any tool that reads your site.

## Worked example: a site that scores badly on a scan

An automated scanner reports "WordPress 5.x detected" on a site that is in fact fully updated. The version came from the generator tag, so the report looked alarming. Removing the tag and `readme.html` clears that line, but the more useful discovery is a plugin three releases behind, which the scanner found through its `readme.txt`. Updating that plugin matters far more. Use scan reports to find what to update, not to decide what to hide.

## What about multisite and managed hosts?

Some managed hosts already remove the generator tag or block the readme files, so check the source before adding code. On multisite, a filter in a network-activated plugin applies to every site. Do not edit server configuration yourself if the host controls it.

## Does it help with search or speed?

No. It has no effect on rankings and any speed difference is a few bytes. The reason to do it is to avoid advertising your exact version, and the reason not to rely on it is that it fixes nothing underneath.

## What actually keeps a site safe, and which hardening steps are worth it?

- Core, plugin and theme updates applied promptly, with a backup before.
- Strong unique passwords and two-factor authentication for administrators.
- Fewer plugins, from maintained authors.
- A firewall and malware scanning.
- Working, tested backups: see [what to back up and how to test a restore](/wordpress-backups-what-to-back-up-and-test-a-restore).
- Someone watching it all: a [care plan](/wordpress-maintenance-service) or our [security service](/wordpress-security-service).

| Hardening step | Stops | Breaks if wrong |
|---|---|---|
| Hide the generator tag | Casual identification | Almost nothing |
| Change the login address ([how](/how-to-change-wordpress-login-url)) | Some automated scanning | Bookmarks, some plugins |
| Block XML-RPC | One class of password guessing | Mobile app and services that use it |
| Block the REST API entirely | Little | Parts of the block editor and many features, so do not do it |

None of these fixes a vulnerable plugin. Keep a short note of every hardening change and re-check after major updates, since a plugin or theme change can quietly bring a tag back.

**Want someone to watch the whole picture?**
Updates, monitoring and tested backups, on a care plan.
[Post a project](/post-project)
[Security service](/wordpress-security-service)

## Frequently asked questions

### Should I hide my WordPress version?

It is a small tidy-up that removes an easy label. It does not make an outdated site safe. Updating is the real defense.

### Where else does the version appear?

In RSS feeds, in readme and license files, in script and style URLs and sometimes in plugin output.

### Will hiding the version break any plugin?

Occasionally a tool uses the generator tag to detect WordPress. Test your SEO and monitoring tools after the change.

### Why does the version number matter at all?

It tells a scanner which known vulnerabilities to try. If you run the latest release that helps nobody; if you run an old one it helps attackers pick a target. Hiding it makes the first step slightly harder and nothing more.

### How do I remove the WordPress version?

In a small plugin or a child theme's functions.php after a backup, add remove_action( 'wp_head', 'wp_generator' ) and add_filter( 'the_generator', '__return_empty_string' ). Check /feed/ as well as the page source.

### Does the same code hide the WooCommerce version?

Current WooCommerce adds its tag by filtering WordPress's generator output, so it should hide too. Confirm in your page source, since plugin internals change, and use remove_filter() with the same hook and priority if a tag remains.

### Should I remove the ?ver= from script and style URLs?

For most sites, leave them alone. They are used for cache busting, so removing them can leave returning visitors with stale files.

### How do I hide readme.html and license.txt?

Delete them from the WordPress root if present and re-check after updates, and use a server rule to deny public access to readme and license files. A wrong rule can take the site down, so back up and ask your host if they manage the configuration.

### Does hiding the version help rankings or speed?

No. It has no effect on rankings, and any speed difference is a few bytes. The reason to do it is to avoid advertising your exact version to automated scanners.

### What keeps a WordPress site actually safe?

Prompt updates with a backup first, strong unique passwords and two-factor authentication, fewer plugins from maintained authors, a firewall and malware scanning, and working tested backups.

### Is blocking XML-RPC or the REST API a good hardening step?

Blocking XML-RPC stops one class of password-guessing attack but breaks the mobile app and some services that use it. Blocking the REST API entirely breaks useful features including parts of the block editor, so do not do that.
