Client Area

 Client Area

How to remove queries strings from your static assets

Sections

    To remove queries strings from your static assets on WordPress, just add the following code in the file functions.php of your theme.

     

    //remove queries 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 );

    in WordPress