To remove the ?ver= value from a WordPress script or stylesheet URL you control, pass null as the fourth argument to wp_enqueue_script() or wp_enqueue_style(). That removes the asset’s version query parameter, but also removes that particular cache-busting signal. For assets registered by core, a plugin, or another theme, you’ll need a carefully scoped URL filter or a plugin—and should test the resulting URLs.
Why WordPress adds ?ver= to asset URLs
WordPress uses the enqueue functions’ version argument to add a query-string value to script and stylesheet URLs for cache busting. If the argument is false, WordPress uses the currently installed WordPress version. The wp_enqueue_script() reference describes it as a value added to the URL “for cache busting purposes”; the wp_enqueue_style() reference describes the stylesheet argument the same way.
For example, an asset URL may end in ?ver=6.x. The value can change when WordPress is updated, giving browsers and caches a different URL to request.
Remove the version from assets you enqueue
For theme assets you control, use WordPress’s enqueue functions and set $ver to null. The Theme Handbook recommends loading theme assets through WordPress’s enqueue hooks and functions so WordPress, themes, and plugins can manage them together.
Free tools Windows power users keep installed
One-click scans. No signup required.
#1 Best Overall
function mytheme_assets() {
wp_enqueue_style( 'theme-style', get_stylesheet_uri(), array(), null );
wp_enqueue_script( 'theme-script', get_theme_file_uri( 'assets/js/theme.js' ), array(), null, true );
}
add_action( 'wp_enqueue_scripts', 'mytheme_assets' );
Here, the fourth argument is the version value: null suppresses the version query parameter for each of these assets. The final true in the script call requests that the script be placed in the footer; it is not the version argument.
Keep the enqueue calls in your theme code rather than replacing them with hard-coded <link> or <script> tags. WordPress’s Theme Handbook guidance on including assets explains how enqueue functions and hooks let WordPress and extensions load assets together.
When the asset belongs to core or a plugin
Changing the version argument in your own enqueue call affects only assets enqueued there. It does not change a script or stylesheet registered by WordPress core, a plugin, or a theme you do not control.
A site-wide alternative is to use the script_loader_src and style_loader_src filters to alter generated asset URLs. The official function references explain the enqueue version argument, but do not prescribe one universal global-filter snippet. Any filter should be tailored to the URLs you intend to change: preserve unrelated query parameters, avoid altering external resources or dynamic endpoints without checking their purpose, and test against the WordPress release, plugins, and assets your site actually uses.
Do these 3 things before closing this tab:
1Fix the driver behind crashes, sound loss and screen glitches2Clear out junk files and repair common Windows errors3Scan for outdated or missing drivers - takes under a minuteChoose between per-asset control and a broader filter
| Approach | Scope | When it fits | Cache consideration |
|---|---|---|---|
Pass null as $ver |
The script or stylesheet in that enqueue call | You control the code that enqueues the asset | Plan another way to make changed files reach cached clients |
| Use a loader filter | Generated URLs matching the filter’s logic | You need to affect assets registered elsewhere | Validate the exact affected URLs and how those assets are refreshed |
The first approach is the direct, documented option for assets you own. A filter can reach more assets, but its wider scope makes careful matching and site-specific testing important.
Account for the cache-busting tradeoff
Removing ?ver= removes that changing URL signal. After you update CSS or JavaScript, a browser, proxy, or CDN may continue serving a cached copy unless you invalidate the cache or use another versioning mechanism. If dependable updates matter, keep a developer-controlled asset version or build hash, or use a cache purge process. These are alternatives to the version value WordPress would otherwise add.
Rank #4
A plugin is optional, not a security fix
If you prefer an admin interface, the WordPress.org listing for Remove WordPress Version – Hide Generator Meta Tag describes separate options for removing the generator meta tag and versions from CSS and JavaScript URLs. It also warns that some script-module URLs may retain a version string. Check the current listing and verify your site’s output before relying on a plugin.
The asset URL is only one place version information can appear. The generator meta tag is a separate output, and removing either one does not guarantee that every version disclosure is gone. Inspect the rendered page source and browser network requests to confirm what changed.
Best Value
Concealing version output is not a substitute for updates. The plugin listing puts it plainly: “Hiding the version will not patch anything, so keep WordPress updated regardless.” Keep WordPress, themes, and plugins current.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




