<font color="#333333"><font><font face="arial,helvetica,sans-serif">Even with multiple libraries wp_deregister_script is not needed. With e.g. wp_enqueue_script('my-script', get_template_directory_uri() . '/js/my-script.js', array('jquery'), '1.0.0', true); you can enqueue as many JS as you want, without conflicts, what you already know. Now just like PHP JS can be overridden with another e.g. my-custom-fancybox as well, so you don't need to deregister. This applies only to WPORG, you can do whatever you please on your site, which doesn't really apply to this topic anyways :) Quick example </font></font></font><font color="#333333" face="arial, helvetica, sans-serif"><a href="http://stackoverflow.com/questions/296667/overriding-a-javascript-function-while-referencing-the-original">http://stackoverflow.com/questions/296667/overriding-a-javascript-function-while-referencing-the-original</a></font><div>
<font color="#333333" face="arial, helvetica, sans-serif"><br></font></div><div><font color="#333333" face="arial, helvetica, sans-serif">Emil<br></font><div><font color="#333333"><font><font face="arial,helvetica,sans-serif"><br>
</font></font></font></div><div><font color="#333333"><font><font face="arial,helvetica,sans-serif"><br></font></font></font><br><div class="gmail_quote">On Wed, May 30, 2012 at 5:00 PM, Sayontan Sinha <span dir="ltr"><<a href="mailto:sayontan@gmail.com" target="_blank">sayontan@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im"><blockquote style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote">
My only question: is there *ever* a legitimate use of wp_deregister_script()?<br></blockquote><br></div>I can think of one corner case, though it is really really rare. Let's say you are using 2 external JS libraries in your theme that don't work with each other out of the box (or they don't give you appropriate results). So you tweak them to make them work. Now, your tweaks are done in a manner that doesn't affect other plugins using unmodified versions of the script. E.g. you might have added a "data" attribute to something in the script. If you want the modified script to be picked up, you would want to deregister the one from the plugin and register yours. Of course, there are potential questions about namespacing such scripts, but those questions exist for any script that is not bundled with WP itself, regardless of wp_deregister_script.<br>
<br>I have had to modify libraries for a plugin - I couldn't get Fancybox / Colorbox / PrettyPhoto to play nicely with JQuery Tooltip, so I had to put in some modifications. I am guessing there might be theme authors requiring to do something similar.<br>
<br>Sayontan.<div class="HOEnZb"><div class="h5"><br><br><div class="gmail_quote">On Wed, May 30, 2012 at 2:48 PM, Chip Bennett <span dir="ltr"><<a href="mailto:chip@chipbennett.net" target="_blank">chip@chipbennett.net</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I agree, too. I think adding wp_dereigster_script() to Theme Check would be a great idea. My only question: is there *ever* a legitimate use of wp_deregister_script()? If so, we can add it as INFO; if not, we can just go ahead and add it as REQUIRED. But, I want to be sure we've considered any unintended consequences before doing so.<div>
<br></div><div>Chip</div><div><br><div class="gmail_quote">On Wed, May 30, 2012 at 4:33 PM, esmi at quirm dot net <span dir="ltr"><<a href="mailto:esmi@quirm.net" target="_blank">esmi@quirm.net</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">on 30/05/2012 22:01 Emil Uzelac said the following:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Also see:<br>
<a href="http://wpdevel.wordpress.com/2011/12/12/use-wp_enqueue_scripts-not-wp_print_styles-to-enqueue-scripts-and-styles-for-the-frontend/" target="_blank">http://wpdevel.wordpress.com/<u></u>2011/12/12/use-wp_enqueue_<u></u>scripts-not-wp_print_styles-<u></u>to-enqueue-scripts-and-styles-<u></u>for-the-frontend/</a><br>
</blockquote>
<br>
I am *so* not arguing against any of this but it does seem to me that the relevant themes could be weeded out at the mandatory checks/upload point. I assume the Theme Check plugin is based on the mandatory checks, yes?<div>
<div><br>
<br>
Mel<span><font color="#888888"><br>
-- <br>
<a href="http://quirm.net" target="_blank">http://quirm.net</a><br>
<a href="http://blackwidows.co.uk" target="_blank">http://blackwidows.co.uk</a><br>
______________________________<u></u>_________________<br>
theme-reviewers mailing list<br>
<a href="mailto:theme-reviewers@lists.wordpress.org" target="_blank">theme-reviewers@lists.<u></u>wordpress.org</a><br>
<a href="http://lists.wordpress.org/mailman/listinfo/theme-reviewers" target="_blank">http://lists.wordpress.org/<u></u>mailman/listinfo/theme-<u></u>reviewers</a><br>
</font></span></div></div></blockquote></div><br></div>
<br>_______________________________________________<br>
theme-reviewers mailing list<br>
<a href="mailto:theme-reviewers@lists.wordpress.org" target="_blank">theme-reviewers@lists.wordpress.org</a><br>
<a href="http://lists.wordpress.org/mailman/listinfo/theme-reviewers" target="_blank">http://lists.wordpress.org/mailman/listinfo/theme-reviewers</a><br>
<br></blockquote></div><br><br clear="all"><br></div></div><span class="HOEnZb"><font color="#888888">-- <br>Sayontan Sinha<br><a href="http://mynethome.net" target="_blank">http://mynethome.net</a> | <a href="http://mynethome.net/blog" target="_blank">http://mynethome.net/blog</a><br>
--<br>Beating Australia in Cricket is like killing a celebrity. The death gets more coverage than the crime.<br><br>
</font></span><br>_______________________________________________<br>
theme-reviewers mailing list<br>
<a href="mailto:theme-reviewers@lists.wordpress.org">theme-reviewers@lists.wordpress.org</a><br>
<a href="http://lists.wordpress.org/mailman/listinfo/theme-reviewers" target="_blank">http://lists.wordpress.org/mailman/listinfo/theme-reviewers</a><br>
<br></blockquote></div><br></div></div>