简体   繁体   中英

Double jQuery entry in wordpress file

I have 2 jquery script tags on this page and I am trying to find where they are inserted from. I have located one which comes from header.php, but cannot find the second one. Is there a browser developer tool that could help me with this?

A browser developer toolbar will not tell you what WordPress item is asking for another jQuery script.

Often plugins and themes will want to include their own version...and it can cause conflicts.

The version of jQuery installed with your wordpress version is 1.10.2, and "something" is calling jQuery 1.8.2.

You may want to try removing the reference to 1.8.2 from your theme file (header.php)

Just try the following mini plugin:

<?php
/** Plugin Name: Debug Scripts */
add_action( 'wp_enqueue_scripts', function() {
    var_dump( current_filter(), $GLOBALS['wp_filters'], $GLOBALS['wp_scripts'] );
}, 999 );

This will tell you

  • The name of the current filter ( wp_enqueue_scripts )
  • All registered filters
  • All registered scripts

Then search for your script, search for the callback and then search for the plugin or theme causing it. You got all the tools.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM