WordPress.org

Ready to get started?Download WordPress

Forums

RS Head Cleaner Plus
[resolved] Next release to include Remove Version from CSS (4 posts)

  1. eljkmw
    Member
    Posted 5 months ago #

    G'day Scott,

    I noticed that your plugin could include another feature to the remove WP versions from all CSS headers. At this moment, I'd to add the following code into the active theme's functions.php

    // Remove WP version param from any enqueued scripts
    function vc_remove_wp_ver_css_js( $src ) {
    	if ( strpos( $src, 'ver=' ) )
    		$src = remove_query_arg( 'ver', $src );
    	return $src;
    }
    add_filter( 'style_loader_src', 'vc_remove_wp_ver_css_js', 9999 );
    add_filter( 'script_loader_src', 'vc_remove_wp_ver_css_js', 9999 );

    This will beef-up your plugin :)

    Cheers,
    Jason

    https://wordpress.org/plugins/rs-head-cleaner/

  2. Scott Allen
    Member
    Plugin Author

    Posted 4 months ago #

    Hi Jason,

    Good call. I had noticed that the versions added to the CSS keeps it from validating.

    Let me just check into it and double-check that it won't affect any WP functionality, and I'll be happy to add that to the next version. That would be great to remove the WP ver number form there too. WP's default setup seems like it would slow down a page at least a little because it won't let the browser use cached versions of the css as it stands.

    Thanks for sharing your code! It should provide both security and speed improvements.

    - Scott

  3. Scott Allen
    Member
    Plugin Author

    Posted 4 months ago #

    Hey Jason,

    I just released the new version with this implemented. Thanks again for the suggestion. :)

  4. eljkmw
    Member
    Posted 4 months ago #

    You're welcome, Scott.

Reply

You must log in to post.

About this Plugin

About this Topic