[wp-hackers] Script Hooks Order

scribu scribu at gmail.com
Fri Mar 27 15:23:15 GMT 2009


This is the order in which hooks are currently called in admin-header.php:

do_action('admin_enqueue_scripts', $hook_suffix);
do_action("admin_print_styles-$hook_suffix");
do_action('admin_print_styles');
do_action("admin_print_scripts-$hook_suffix");
do_action('admin_print_scripts');
do_action("admin_head-$hook_suffix");
do_action('admin_head');


Wouldn't it make more sense first to call the general hooks, and then the
ones with $hook_suffix ? I was trying to add some inly jQuery to a
particular page and got the "jQuery is not defined" error because jquery was
added bellow my script.

I realize now that I could have just used "admin_head-$hook_suffix" instead
of "admin_print_scripts-$hook_suffix", but is there any reason for adding
particular scripts and styles before general styles?

-- 
http://scribu.net


More information about the wp-hackers mailing list