[wp-hackers] Script Hooks Order

Otto otto at ottodestruct.com
Sat Mar 28 20:24:19 GMT 2009


A particular plugin may want to modify the scripts before they get
output by the general hook, so the suffix first makes more sense.

-Otto
Sent from: Memphis Tennessee United States.


On Fri, Mar 27, 2009 at 10:23 AM, scribu <scribu at gmail.com> wrote:
> 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
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>


More information about the wp-hackers mailing list