Home / Admin / Remove Unused Javascript
Duplicate Snippet

Embed Snippet on Your Site

Remove Unused Javascript

Remove Unused Javascript – and improve your Page Speed Insight Score

Code Preview
php
<?php
//This has been syncronised 123//
function wp_remove_scripts() {
// check if user is admina
    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 );

Comments

Add a Comment