Dequeue Wordpress Scripts

Matthew B
Matthew B used Ask the Experts™
on
I have a bunch of JQUERY UI files that load in the footer of my wordpress site.

These files are in my wp-includes/js/jquery/ui folder, is it bad if i minify + combine all of these files?

I tried to put this in my functions.php but it wasnt working. How can i get rid of wordpress from loading all of these UI scripts and load my combined file?

if(!is_admin(){
wp_dequeue_script(' autocomplete '); //url wp-includes/js/jquery/ui/autocomplete.min.js
wp_dequeue_script(' core ');  //url wp-includes/js/jquery/ui/core.min.js
wp_dequeue_script(' menu ');  //url wp-includes/js/jquery/ui/menu.min.js
wp_dequeue_script(' position ');  //url wp-includes/js/jquery/ui/position.min.js
wp_dequeue_script(' widget ');  //url wp-includes/js/jquery/ui/widget.min.js

wp_register_script(' combined-script', 'wp-includes/js/combined-script.js', '1.0.0'); //register script
wp_enqueue_script(' combined-script '); //hooks into add_action


}
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Hack
Commented:
Answer:
//remove jquery migrate
function remove_jquery_migrate( $scripts ) {
    if ( ! is_admin() && isset( $scripts->registered['jquery'] ) ) {
        $script = $scripts->registered['jquery'];

        if ( $script->deps ) {
            $script->deps = array_diff( $script->deps, array( 'jquery-migrate' ) );
        }
    }
}
add_action( 'wp_default_scripts', 'remove_jquery_migrate' );

and
wp_deregister_script('jquery-ui-core');

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial