[wp-trac] [WordPress Trac] #25017: Dont allow empty $src parameter in wp_register_script

WordPress Trac noreply at wordpress.org
Wed Dec 18 01:09:18 UTC 2013


#25017: Dont allow empty $src parameter in wp_register_script
--------------------------+---------------------
 Reporter:  oskarhane     |       Owner:  nacin
     Type:  defect (bug)  |      Status:  closed
 Priority:  normal        |   Milestone:  3.7
Component:  General       |     Version:  3.6
 Severity:  normal        |  Resolution:  fixed
 Keywords:                |
--------------------------+---------------------
Changes (by benfreke):

 * cc: benfreke (added)


Comment:

 This fix works, so I've left this closed. However, if a theme runs a check
 of is_admin() before deregistering the jquery, you get a message about not
 using wp_deregister_script in the administration screen when you attempt
 to login (with WP_DEBUG set to true, obviously).

 Could I make a suggestion that the language or the error message be
 updated to reflect the fact that this check is no longer in just the
 administration? Ideally, pull the check completely out of the function and
 create a new function. This should also allow for quicker future updates
 if other areas of WordPress need to use this check.

 Pseudo code:

 {{{
 if (is_admin()) {
   _keep_core_scripts_registered($handle, 'administration area');
 } elseif (is_login()) {
   _keep_core_scripts_registered($handle, 'login screen');
 }

 protected function _keep_core_scripts_registered($handle, $area)
 {
   // array of protected script handles
   // filter to add/remove scripts from above array
   if ( not allowed to be deregistered) {
     // as per existing function with second param passed to sprintf
   }
 }
 }}}

--
Ticket URL: <http://core.trac.wordpress.org/ticket/25017#comment:12>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list