showing results for - "wordpress disable jquery migrate"
Giovanni
25 Jan 2019
1PHPfunction remove_jquery_migrate( $scripts ) {
2	
3	if ( ! is_admin() && isset( $scripts->registered['jquery'] ) ) {
4			
5		$script = $scripts->registered['jquery'];
6		
7		if ( $script->deps ) { 
8			$script->deps = array_diff( $script->deps, array( 'jquery-migrate' ) );
9		}
10	}
11}
12add_action( 'wp_default_scripts', 'remove_jquery_migrate' );
Leelou
10 Aug 2020
1/**
2 * Disable jQuery Migrate in WordPress.
3 *
4 * @author Guy Dumais.
5 * @link https://en.guydumais.digital/disable-jquery-migrate-in-wordpress/
6 */
7add_filter( 'wp_default_scripts', $af = static function( &$scripts) {
8    if(!is_admin()) {
9        $scripts->remove( 'jquery');
10        $scripts->add( 'jquery', false, array( 'jquery-core' ), '1.12.4' );
11    }    
12}, PHP_INT_MAX );
13unset( $af );
14