Some time ago, I mentioned about Plugin Organizer and the benefits of loading plugins on pages when we only need them as we want to decrease page size and make our WordPress pages load faster, especially if we use a cache plugin such as W3 Total Cache.
However, there are situations when we need a plugin on a page or we use a theme, but some of the CSS and JavaScript files are not needed. Imagine a contact page where you only have some text and a form and you are using a theme that loads plenty of useless CSS and JavaScript files. Not ideal for our website visitors that should enjoy a faster page load.
I’ve decided to write my first official free plugin and share it with the WordPress community.
WP Asset Clean Up scans the page you’re editing, detects the loaded scripts and styles and shows them in a list where you can choose the ones that you do not want to load.
What are the benefits of using this plugin?
- The HTTP requests on your website will decrease thus saving you bandwidth (good, if you don’t have unlimited with your host) and your pages will load faster
- In case there are conflicts between scripts (from plugins/themes) that are loading on the same page, you can remove the ones that you don’t need, thus minimizing the risk of JavaScript errors. If you’re a developer, you know how many headaches you can have when you’re debugging errors on a page that have 20 .js files loaded from various plugins (and you only need 5 of them).
- The HTML source code will be smaller, cleaner and easier to read when you’ll need to find something.
- The Apache log files will also be smaller and easier to read since fewer requests will be made to the server.
This plugin is powerful in combination with a cache plugin that also combines the remaining loaded assets (.css and .js files) to minimize the number of HTTP requests.
Thank your recommend
W3 Total Cache using faster loading website
What a fantastic idea – don’t load unused scripts for a particular page or post!
Put it to the test on a play site. The play site was loading a Google Map script on every page, but the Google Map was only needed in the Contact Us page. Yeah I know, why load a script when it’s not needed? Boom! and then I find this 🙂
This little beauty is fantastic!
looking forward to its development over time.
@Chook, thanks for the feedback. I left you a reply on WordPress.org, updated the plugin on the repository and on your test website. As you can see, it works 100% now without any issues. I wish you could update the rating you left at least for the support I offered 🙂
Hi
Have you encountered problems when using SSL?
I receive a message saying no scripts or styles are enqueued properly (although too many are!) on https://thestatemanagementstory.org
I’m using Really Simple SSL
If your plugin works, I’d pay for it.
Thanks
Paul
Hi –
I tried to submit a bug report in both Firefox and Chrome, but both times I got an error saying that the recaptcha was required, but there wasn’t one anywhere on the page.
I’ve been using the free version of your plugin for a while and just upgraded to the paid version in order to be able to unload rules from categories and tags. Great tool, thanks so much!
I’m having a problem with “bulk unloaded” /wp-admin/admin.php?page=wpassetcleanup_bulk_unloads. There are a couple of items in both styles and scripts that belong to a plugin that’s no longer installed on my site, so I’m trying to remove them, but when I click “update” the page just reloads – they’re all still there and there’s no error message. Any ideas?
Thank you,
Laura
Hello, Laura!
Thank you for using the plugin. I’ll check the problem on the contact form, it’s good that you reported it. I’ve done some changes there and you should be able to submit the contact form properly now. Regarding the bug you noticed, it will be fixed in the next version of the plugin which you will be able to update automatically within the Dashboard (if you have activated the license). Someone else reported it as well and it looks like it does this to elements from plugins that are not loading anymore.
Note that this is just a record in the database that is just printing there and in no way the asset is loading so it won’t affect your website functionality (e.g. making it slower). Since the plugin doesn’t load, the asset won’t load either. I know, it annoying to see it printed there, and not being able to clean the database record (which you can do it directly through a software like phpMyAdmin if you know what you’re doing, but I recommend to not touch that if you’re not a developer or have experience with MySQL databases), but you can just ignore it for now. If you’re keen to have it removed sooner from that list, let me know and we can take the matter on private. My apologies for this inconvenience!
All the best,
Gabe
Hi
Please, where can I disable this setting (WordPress CSS & JavaScript core files are hidden as requested in the plugin’s settings) to be able to see wordpress java files?
Fausto, go to “Settings” -> “General & Files Management” then scroll to “Hide WordPress Core Files From The Assets List?” and uncheck the option to show the WordPress core files. Just be careful when you unload any of them 😉
Thank you very much Gabe