Remove Query Strings from Static Assets in WordPress Website


This article provides the required steps to remove query strings from static assets in WordPress websites.

Edit WordPress Theme functions.php File

Add the following code to the theme's functions.php file (located in /wp-content/themes/themename/ directory):

//remove query strings from static assets
function _remove_script_version( $src ){
$parts = explode( '?ver', $src ); 
return $parts[0]; } add_filter( 'script_loader_src', '_remove_script_version', 15, 1 ); add_filter( 'style_loader_src', '_remove_script_version', 15, 1 );
  • wordpress, theme
  • 3 Bu dökümanı faydalı bulan kullanıcılar:
Bu cevap yeterince yardımcı oldu mu?

Related Articles

Extended List of WordPress Ping Update Services

This article provides an extended list of WordPress ping Update Services. This list is an...

Features of Softaculous WordPress Manager

All Rad Web Hosting servers used in fulfilment of cPanel Hosting and WHM Reseller Hosting...

How to Install WordPress Using Softaculous

This tutorial will guide you how to install WordPress with just few clicks using Softaculous....

How to Safely Rename WordPress Database

This article provides a guide for how to safely rename WordPress database. This guide is intended...

How to Install and Enable WP-CLI on WHM cPanel Server

This article provides a guide for how to install and enable WP-CLI on cPanel WHM server. This...