Home / Disable / Remove Default jQuery
Duplicate Snippet

Embed Snippet on Your Site

Remove Default jQuery

Code Preview
php
<?php
// Remove default WordPress jquery
wp_deregister_script( 'jquery' );
//Remove jquery migrate
add_action( 'wp_default_scripts', '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' ) );
		}
	}
}

Comments

Add a Comment