'Remove a query string added to Wordpress URLs
I have to work with a Wordpress installation that wasn't mine, and I need to work out some things to optimize performance.
Among other things, I've found that almost every single URL, specially for static files, is appended with a query string, and it's always the same:
- https://www.example.com/wp-content/uploads/2013/06/gfi-150x42.png?e1e0dc
- https://www.example.com/wp-content/uploads/2013/06/healthline-150x42.png?e1e0dc
And so on.
Does anybody know a plugin that can be causing this? I have the following installed, and i can't find the one causing it or if it's something else:
- Advanced Custom Fields
- Akismet
- Category Post Widget
- Contact Form 7
- Envato WordPress Toolkit
- Forms: 3rd-Party Integration
- Google XML Sitemaps
- LayerSlider WP
- Ready! Backup
- Ready! Backup PRO
- Redirection
- Remove query strings from static resources
- Special Recent Posts FREE Edition
- Twoot ToolKit
- W3 Total Cache
- Wickett Twitter Widget
- WordPress-to-Lead for Salesforce CRM
- WordPress HTTPS
- WordPress SEO
- WP-PageNavi
Solution 1:[1]
Appending a version number as a URL query string is a common cache-busting solution.
It looks like W3 Total Cache may be the culprit here. Their website says that one of the features is:
- Browser caching using cache-control, future expire headers and entity tags (ETag) with "cache-busting"
According to the author of the plugin, you can disable this feature:
Uncheck the "Prevent caching of objects after settings change" option on the browser cache settings tab.
Solution 2:[2]
You can remove query strings from theme resources (css and javascript files) with this in your theme's functions.php file:
// Remove Query Strings from enqueue scripts
add_filter( 'style_loader_src', 'remove_query_string' );
add_filter( 'script_loader_src', 'remove_query_string' );
function remove_query_string( $url )
{
return remove_query_arg( 'ver', $url );
}
As for query strings from plugins, I assume that will be a similar fix in each plugin.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Community |
| Solution 2 | markratledge |
