Support » Developing with WordPress » 4.8.1 enqueue script version problem

  • Resolved jodayeah

    (@jodayeah)


    Hi guys,

    since updating to 4.8.1 I am having a problem with my enqueued scripts. This is how I try to load isotope script in a custom plugin:

    function isotope_plugin() {
    	wp_enqueue_script('isotope', 'https://unpkg.com/isotope-layout@3.0/dist/isotope.pkgd.js', array('jquery'), false, false);
    }
    
    add_action( 'wp_enqueue_scripts', 'isotope_plugin' );  

    However I get an error because the script can’t be found. I checked and this is because my current WordPress version 4.8.1 gets added to the script src so that it reads “https://unpkg.com/isotope-layout@3.0/dist/isotope.pkgd.js?ver=4.8.1”. That is although I specifically asked to add no version number. The same happens if I just define the handle and the src like so

    
    function isotope_plugin() {
    	wp_enqueue_script('isotope', 'https://unpkg.com/isotope-layout@3.0/dist/isotope.pkgd.js');
    }
    
    add_action( 'wp_enqueue_scripts', 'isotope_plugin' );  

    I can’t seem to get rid of the Worpdress version number.
    This happens with all scripts I enqueue through this plugin.

    • This topic was modified 4 months ago by  jodayeah.
Viewing 3 replies - 1 through 3 (of 3 total)
  • chrispink

    (@chrispink)

    wp_enqueue_script(‘isotope’, ‘https://unpkg.com/isotope-layout@3.0/dist/isotope.pkgd.js’, array(‘jquery’), null, false);

    Moderator Steve Stern

    (@sterndata)

    See https://developer.wordpress.org/reference/functions/wp_enqueue_script/
    You should be using null, not false.

    $ver
    (string|bool|null) (Optional) String specifying script version number, if it has one, which is added to the URL as a query string for cache busting purposes. If version is set to false, a version number is automatically added equal to current installed WordPress version. If set to null, no version is added.
    Default value: false

    jodayeah

    (@jodayeah)

    Ah, damn, right. Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.