Remove Query Strings From Static Resources

 In All, Optimization & Best Practices, Security

How to Remove Query Strings From Static Resources in WordPress

When we talk about WordPress performance, this issue comes up quite often. Our CSS and JavaScript files normally have the file version on the end of their URLs, such as domain.com/style.css?ver=1.0.

Some web servers are unable to cache query strings, even if a header is present. So the solution to avoid web server cache issues is removing the version from the URL. This will fix that warnings that you see in Pingdom and GTMetrix called “Remove query strings from static resources.”

Add the code below on your functions.php.

Recent Posts

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Start typing and press Enter to search

Let's work together

I'd love to work with you! Please fill out my project form to tell me more about your project/work. I reply to all enquiries within 48 hours.

Availability

  • November - Booked
  • December - Booked
  • January - Available

Rates

  • My day rate is £300.
  • I can provide a fixed price for your work.

EN - Header Enquiry Form

  • This form collects your name, email address and telephone number so that I can respond to the enquiry(ies) that you submit via this website. Please check my privacy policy for the full story on how I use, protect and manage your submitted data.