De-register De-queue WordPress Loaded Scripts & Styles

You can de-register and de-queue WordPress loaded javascripts and CSS styles by passing them into the wp_print_scripts function. This can help with fewer server requests if the scripts are no longer required or if a conflict is occurring.

So for example if I wanted to remove the WordPress TwentyTwelve default mobile menu javascript you would use:

//Remove twentywelve Mobile Javascript
function de_script() {
    wp_dequeue_script( 'twentytwelve-navigation' );
    wp_deregister_script( 'twentytwelve-navigation' );
}

add_action( 'wp_print_scripts', 'de_script', 100 );

You just need to know what name of the script was used to de-register and de-queue it.

1 Comment

  1. […] De-register De-queue WordPress Loaded Scripts & Styles is a post from: coolestguyplanettech.com […]

Leave a Comment





%d bloggers like this: