WordPress.org

Make WordPress Core

Changes between Version 1 and Version 2 of Ticket #45130, comment 8


Ignore:
Timestamp:
10/25/2018 08:31:26 AM (2 years ago)
Author:
remzicavdar
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #45130, comment 8

    v1 v2  
    2525}}}
    2626In jQuery 3 there's no need to put this. I have updated my examples.
     27
     28
     29PS: Could give me an example how I could use ! is_admin() and ! is_customize_preview()to exclude. This is what I do:
     30
     31{{{#!php
     32<?php
     33function jquery_updater()
     34{
     35   
     36    // jQuery
     37    // Deregister core jQuery
     38    wp_deregister_script('jquery');
     39    // Register
     40    wp_enqueue_script('jquery', plugins_url('/js/jquery-3.3.1.min.js', __FILE__), false, '3.3.1');
     41   
     42    // jQuery Migrate
     43    // Deregister core jQuery Migrate
     44    wp_deregister_script('jquery-migrate');
     45    // Register
     46    wp_enqueue_script('jquery-migrate', plugins_url('/js/jquery-migrate-3.0.0.min.js', __FILE__), array(
     47        'jquery'
     48    ), '3.0.0'); // require jquery, as loaded above
     49}
     50
     51add_action('wp_enqueue_scripts', 'jquery_updater');
     52}}}
     53