Conflict with WordPress Plugins and jquery script

Problem: When adding my own script to WordPress using:

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>

I found that the script did not run.

Solution: Add this to your functions.php and you will not have to declare the Google AJAX library in your code. At time of writing the version was 1.8.3 – you will need to update this as necessary.

(Please note, that this method includes jquery from CDN (Content Delivery Network).I am assuming thatthe likelyhood of google being down is low.)

function my_scripts_method() {
if (!is_admin()) {
wp_deregister_script( 'jquery' );
wp_register_script( 'jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js');
wp_enqueue_script( 'jquery' );
}
}

add_action('wp_enqueue_scripts', 'my_scripts_method');

endif;
Bookmark the permalink.