Make WordPress Core

Changes between Initial Version and Version 1 of Ticket #54884, comment 6


Ignore:
Timestamp:
01/25/2022 07:55:38 AM (5 years ago)
Author:
galbaras

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #54884, comment 6

    initial v1  
    1414
    1515This means that it should be possible to disable it per site, rather than load it "just in case" on sites that don't need it. See also (#37110 and) #51812.
     16
     17Here's the code for this too:
     18
     19{{{
     20add_action( 'wp_default_scripts', 'remove_jquery_migrate_script' );
     21function remove_jquery_migrate_script( $scripts ) {
     22        if ( ! is_admin() && isset( $scripts->registered['jquery'] ) ) {
     23                $script = $scripts->registered['jquery'];
     24                if ( $script->deps ) {
     25                        $script->deps = array_diff( $script->deps, array( 'jquery-migrate' ) );
     26                }
     27        }
     28}
     29}}}