Remove Query String From SyntaxHighlighter CSS URLs

If you use the SyntaxHighlighter Evolved WordPress plugin by Alex Mills (Viper007Bond), you may notice that the CSS file source URLs are appended with a query string to add the version.

If you run a speed test on a page with SyntaxHighlighter, you may get a recommendation to “remove query strings from static resources.”

Or, you may get a speed test result like this:

Resources with a “?” in the URL are not cached by some proxy caching servers. Remove the query string and encode the parameters into the URL for the following resources:


You can fix this issue by removing the “version” URL query string from the SyntaxHighlighter Evolved CSS resource URLs. The following code will remove the query string for both of the stylesheets loaded by SyntaxHighlighter: the SyntaxHighlighter core CSS URL, and the SyntaxHighlighter theme CSS URL.

To do this, add this code to your functions:

/* Remove the version query string from SyntaxHighlighter CSS urls */

function isa_remove_syntaxhighlighter_css_querystring( $src ) {
	// Does this URL have a query string beginning with ?ver=
	$ver = strpos( $src, '?ver=' );
	if ( $ver !== false ) {
		$parts = explode( '?', $src );
		$src = $parts[0];
	return $src;

// Remove it from SyntaxHighlighter core CSS url

add_filter( 'syntaxhighlighter_csscoreurl', 'isa_remove_syntaxhighlighter_css_querystring' );

// Remove it from SyntaxHighlighter theme CSS url

add_filter( 'syntaxhighlighter_cssthemeurl', 'isa_remove_syntaxhighlighter_css_querystring' );

Then, clear any cache plugins that you may have, and re-do the speed test. The above issue should be resolved.

Also see these for how to remove other query strings in WordPress:

Remove Query Strings from Static Sources in WordPress
Remove URL Query String Parameters from Gravatars in WordPress

See more: , , ,


Questions and Comments are Welcome

Your email address will not be published. All comments will be moderated.

Please wrap code in "code" bracket tags like this: