Remove Unused CSS and JavaScript Files with WP Asset CleanUp


Back in 2010, Google announced that they are using site speed in web search ranking.

Speeding up websites is important — not just to site owners, but to all Internet users. Faster sites create happy users and we’ve seen in our internal studies that when a site responds slowly, visitors spend less time there. But faster sites don’t just improve user experience; recent data shows that improving site speed also reduces operating costs. Like us, our users place a lot of value in speed — that’s why we’ve decided to take site speed into account in our search rankings.

Not only your website has chances in ranking higher, but you also make your visitors happier and you will end up having more conversions if you focus on making your pages load faster.

Often when you use themes and plugins that are loading a substantial number of CSS and JavaScripts files you end up having a slow page due to the total number of HTTP requests (some of the files like JS libraries can be quite large) and even JS errors due to conflicts between unoptimised JavaScript files loading in the same page.

For instance, you might use a plugin that generates contact forms and it loads its assets (.CSS and .JS files) in every page of your website instead of doing it only in the /contact page (if that’s the only place where you need it).

WP Asset CleanUp offers you a way to unload all the assets that are not needed in your pages. It will print out all the files that are enqueued in WordPress, and then you can decide which doesn’t belong in that page.

Some of the advantages of using this plugin are:

  • Less HTTP requests loaded (important for faster load)
  • Reduces the HTML code of the actual page (that’s even better if GZIP compression is enabled)
  • Makes HTML code easier to scan and find things (even better if you’re a developer)
  • Removes possible conflicts between plugins/theme (e.g. two .js files that are loading from different plugins and they interfere)
  • Better performance score if you test your URL on websites such as GTmetrix, PageSpeed Insights, Pingdom Website Speed Test
  • Google will love your website more as it would be faster and fast page load is nowadays a factor in search ranking
  • Your server access log files (e.g the Apache ones) will be small, easier to go through and would take less space on your server

At the time of writing (11 December, 2016), with this plugin you can unload scripts and styles for posts, pages, custom post types and the homepage. Bulk unloading is also available. If you want, for instance, to unload a script that is loading on pages belonging to a specific post type (e.g. could be “product” from WooCommerce) or unload it everywhere, this is also possible.

WP Asset CleanUp detects only the styles and scripts that are enqueued into WordPress the right way (e.g. via wp_enqueue_script and wp_enqueue_style functions), not hardcoded (as this would be against the WordPress standards) as this is a bad practice anyway and most of the well known themes and plugins (if not all) should follow the rules and use the right functions to load their scripts.

Combined with a cache plugin that will exponentially improve the loading speed of WordPress pages, WP Asset CleanUp will make things even better for both the visitors and the developers.

Get WP Asset CleanUp plugin

About Gabriel Livan

Gabriel Livan is Freelance Full-Stack Web Developer, WordPress specialist and a problem solver. He enjoys making scalable and fast loading websites as well as offering consultancy to anyone interested in having a professional and easy to scale WordPress website.

Related Articles

  • Have you been struggling with the need to organize media files and folders in WordPress too? Well, don’t worry; you are not the only one. WordPress, with all its benefits…

  • New WP Engine Discount Code

    Here's a great new discount code for WP Engine. Click this link to sign up for any WP Engine plan, then enter the 'HEATWAVE' coupon to get 3 months off…

  • As our plugin WordPress RSS Feed import and aggregation plugin (WP RSS Aggregator) continues to soar in popularity, I thought it would be a good idea to record a quick…

14 Responses

    MUKESH MAJUMDER January 6, 2017 at 22:10 | | Reply

    really awesome article for a beginner like me.. thanks for sharing it…

  2. Vikas Sahu
    Vikas Sahu March 31, 2017 at 02:41 | | Reply

    Grateful Post For Me

  3. Masum
    Masum April 11, 2017 at 21:08 | | Reply

    awesome article for a beginner like me

  4. ravi
    ravi February 23, 2018 at 20:00 | | Reply

    awesome post for beginner

  5. Lekh
    Lekh March 16, 2018 at 23:15 | | Reply

    Cool! Keep Posting Such Type Of Articles.. 🙂

  6. Umair
    Umair April 9, 2018 at 02:53 | | Reply

    Will this remove the css and javascript error in Google speed check tool?

  7. Danish siddiqui
    Danish siddiqui February 4, 2019 at 06:04 | | Reply

    hi I am a beginner how to fix Eliminate render-blocking resources

  8. Jesusful
    Jesusful May 22, 2019 at 18:49 | | Reply

    I’ve been trying to remove unused css for my gospel songs blog. I’ll try this out

  9. PayPal Nigeria
    PayPal Nigeria September 21, 2019 at 20:58 | | Reply

    I’ve been trying to remove unused css for my gospel songs blog

  10. Onos Song
    Onos Song October 2, 2019 at 01:49 | | Reply

    been trying to remove unused css for my gospel songs blog

  11. Corbett Safari Booking
    Corbett Safari Booking December 28, 2019 at 02:43 | | Reply

    We are User this Plugin and WOrking very fine good

  12. Online Corbett
    Online Corbett December 28, 2019 at 08:29 | | Reply

    Nice! Keep up like these posts

  13. JesusLovesMp3
    JesusLovesMp3 February 22, 2020 at 16:57 | | Reply

    I’ve been trying to remove unused css for my gospel songs blog. I’ll try this out tonight.

  14. indel
    indel June 23, 2020 at 18:28 | | Reply

    i have been trying to remove some junk Css on my website GOSPELLIFE but couldnt i will try this out

Leave a Reply