AI Verified
Remove Unused Javascript
Remove Unused Javascript - and improve your Page Speed Insight Score
Javascript
Voted: 35 by 37 user(s)
Run everywhere inside Code Snippets
Scroll down to see more snippets from this codevault.
The author has indicated that this snippet is compatable up to wordpress version: Not Specified
Our AI bot has checked this snippet is compatable up to wordpress version: 6.1
Free & Pro
Download this snippet by clicking the download button, then head over to the Code Snippet Plugin settings in your wordpress admin dashboard, select the import menu then upload this file to import into your wordpress site.
Pro Only (Coming Soon)
You will be able to click a button and sync this snippet to your wordpress site automatically and from your dashboard manage all code snippets across all your wordpress sites that have the Code Snippets Pro plugin installed.
Last modified:
09/09/2024
This snippet has the following status:
AI Verified
This snippet has been tested by our AI bot, see any comments below.
AI Bot Comments:
Found 0 vulnerabilities
35
2 years ago
Nice!
2 years ago
Does this check for unused scripts for every page of the website?
1 year ago
Stav - check this part of the snippet: ---------- if ( is_page( 'homepage' ) ) { // Remove Scripts wp_dequeue_style( 'jquery-ui-core' ); } -------- So this one checks only the homepage. You'll have to check for each page separately.
1 year ago
Nice - keep on optimising @Web Squadron 😎
1 year ago
When I have downloaded the snippet, it appears as JavaScript snippet. This is PHP code.
1 year ago
This only works for non default scripts, but the example is about jquery-ui-core, that is part of Wordpress defaults scripts, the correct addd_action hook in this case would be 'wp_default_scripts' : /** * remove unused Wordpress default scripts from frontend */ add_action( 'wp_default_scripts', 'remove_js_ui_library' ); function remove_js_ui_library( &$scripts){ if(!is_admin()){ $scripts->remove( 'jquery-ui-core'); } }
5 months ago
bagus terus di tingkatkan
Please see some snippets below related to this snippet..
Performance
AI Verified
Performance
AI Verified
Added: 1 year ago
Last Updated: 2 months ago
Remove Gutenberg Block Library CSS from loading on the frontend for better perf, if you don't use him
Performance
AI Verified
Added: 1 year ago
Last Updated: 5 months ago
Ensure Webfont is loaded
These are some popular snippets from this users codevault..
Performance
AI Verified
Added: 2 years ago
Last Updated: 1 week ago
Remove Unused Javascript - and improve your Page Speed Insight Score
WooCommerce
Pro Verified
Added: 2 years ago
Last Updated: 2 months ago
Deactivate some WooCommerce Checkout Fields from showing
Elementor
AI Verified
Added: 9 months ago
Last Updated: 3 months ago
This can be used for any WordPress Builder to aid working with CSS Grids.
Category
Snippet Status