我通常将其作为插件js文件的依赖项加载,如下所示:
if ( is_admin() ) {
//load my plugin\'s js
add_action(\'admin_print_scripts\', \'my_plugin_load_js\' );
}
function my_plugin_load_js() {
$plugin_js = WP_PLUGIN_URL . \'/\' . plugin_basename( dirname(__FILE__) ) . \'/my-plugin.js\';
wp_enqueue_script(\'my-plugin-js\', $plugin_js, array(\'jquery-ui-tabs\'), \'1.0\');
}