Remove Unused JS Page Optimization

————-Remove Unused JS Page Optimization————-
Remove Unused JS

/**
* We will Dequeue the jQuery UI script as example.
*
* Hooked to the wp_print_scripts action, with a late priority (99),
* so that it is after the script was enqueued.
*/
function wp_remove_scripts() {
// check if user is admin
if (current_user_can( ‘update_core’ )) {
return;
}
else {
// Check for the page you want to target
if ( is_page( ‘homepage’ ) ) {
// Remove Scripts
wp_dequeue_style( ‘jquery-ui-core’ );
}
}
}
add_action( ‘wp_enqueue_scripts’, ‘wp_remove_scripts’, 99 );

Picture of Editors Team
Editors Team
Welcome to BigHungama.com, the ultimate hub for coding, learning, and innovation! We are a passionate team of educators, developers, and tech enthusiasts dedicated to making coding accessible, fun, and impactful for everyone.

Leave a Reply

Your email address will not be published. Required fields are marked *

Welcome to BigHungama.com, the ultimate hub for coding, learning, and innovation! We are a passionate team of educators, developers, and tech enthusiasts dedicated to making coding accessible, fun, and impactful for everyone.
Flag Counter

© Copyright 2025, All rights reserved. Web Sense Services