Never, EVER, de-register jQuery in WordPress. If you do, kittens will die, the sky will fall and the world could end. Oh – and WordPress may stop working.
Seriously, there is absolutely no need to ever de-register core jQuery.
Haha! Okay, granted. Obviously it destroys the password protect.
The goal of the deregister is to register a controlled copy in the theme itself. I need control over versioning of the Jquery, I want to be able to use a copy that will not change with an update, to avoid deprecated code.
WP does a really good job of keeping a good version of jquery in the includes, however I want to be 100% that updating wordpress will not break a client’s site. (I can deal with WP deprecated code, but jQuery deprecates stuff that is widely used..)
And still, for the matter of it, why does jquery have anything to do with the password page?
I need control over versioning of the Jquery
Why? Isn’t WordPress doing a good enough job already? Jquery is used all over the place in WordPress core and de-registering it in favour of another version causes no end of problems in core as well as in themes & plugins.
even if the follow is true?
<?php
if (!is_admin()) {
$handle = 'jquery';
$src = get_template_directory_uri() . '/js/jquery.min.js';
$deps = false;
$ver = '1.9.1';
$in_footer = false;
wp_deregister_script($handle);
wp_register_script($handle, $src, $deps, $ver, $in_footer );
} ?>
(excuse me if this goes back and forth. I’m just really trying to understand a few things with this.)
Using is_admin() will limit the potential damage to the back end of the site but it won’t address issues raised by themes & plugins that make the (perfectly valid) assumption that the site will be using core jQuery. I know from bitter experience just how problematic this can be when trying to troubleshoot a previously well-behaved plugin that has suddenly started misbehaving or just stops working completely.
Alright, you offer compelling evidence and I will heed your advice. Troubleshooting issues with deprecated code has only seldom been an issue (that being upgrade from really old versions of WordPress to a modern one, WordPress has offered pretty solid upgrades.
Thank for your insight.
that being upgrade from really old versions of WordPress to a modern one
In that situation, did you follow the instructions in Upgrading_WordPress_Extended?
I have not, this happens rarely. But there are the possibilities in which this does change things. (in which I’ll keep this in mind)
Another question on it, why is the WP-includes jquery different than a copy of the same version that would make things like this break? (Aside from the jQuery.noConflict();