Just about to launch a WordPress site but have noticed that it's currently loading in two jquery files, one in wp-includes and one from my header.php
, is there a way to make wordpress load the wp-include one on the front end? Done quite a bit of search and have the only mention of this seems to include the following code, but I can't find any documentation about it, any ideas?
<?php wp_enqueue_script("jquery"); ?>
As of WordPress 3.3, this is the best way to do it, using the proper hook:
Actually, you need to use
admin_init
hook to make it work in admin section:you need to include the following code before
<?php wp_head(); ?>
in your header.phpand you can remove other jquery includes from header.php
In addition to what Aram Mkrtchyan said, you can enqueue your scripts also using
wp_enqueue_script()
.The third argument to
wp_enqueue_script()
tells WordPress thatyour_script
is dependent onjquery
, so load it only afterjquery
has loaded.