开发者

How/where is wordpress including jquery in the header of my file?

Wordpress is somehow including jquery in the header of开发者_运维技巧 my site. I already have jquery manually installed, and would prefer to turn off the extra inclusion.

It doesn't seem to be coming from any plugins. Does anyone have any ideas where it may be coming from?


It's automatically called when other scripts dependent on it are called using wp_enqueue_script.

Instead of putting it inline in your header add this to your functions.php

add_action( 'init', 'daves_jquery' )
function daves_jquery() {
if (!is_admin() ) {
wp_deregister_script( 'jquery' );
wp_register_script ( 'jquery', '/path_to_your_jquery/jquery.js', true);
wp_enqueue_script( 'jquery' );
}
}


Chances are, this is being done with a hook, which uses the add_action API function. Check the functions.php file in your theme and see if there's anything in there that's doing it.

See http://codex.wordpress.org/Plugin_API#Hook_to_WordPress for more details on hooks.

Also, if you know what the added action is named, you can remove it by placing code like this in the functions.php file in your theme:

remove_action('wp_head', 'wlwmanifest_link');

In the example code, this will remove a registered action call wlwmanifest_link that was tacked onto the wp_head section of the action loop. Chances are, the add_action statement you're looking for that is including jquery will be attached to wp_head since that's how you get code inserted there during the loop.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜