[wp-trac] [WordPress Trac] #34334: Add a dynamic version of the admin_print_footer_scripts hook

WordPress Trac noreply at wordpress.org
Fri Oct 16 21:46:19 UTC 2015


#34334: Add a dynamic version of the admin_print_footer_scripts hook
-------------------------+-----------------------------
 Reporter:  tfrommen     |      Owner:
     Type:  enhancement  |     Status:  new
 Priority:  normal       |  Milestone:  Awaiting Review
Component:  General      |    Version:
 Severity:  normal       |   Keywords:
  Focuses:               |
-------------------------+-----------------------------
 The `/wp-admin/admin-header.php` file fires both the generic
 `admin_print_scripts` and the dynamic `admin_print_scripts-$hook_suffix`
 action hooks. The counterpart `/wp-admin/admin-footer.php`, however, only
 fires a generic action hook, `admin_print_footer_scripts`, which does
 '''not''' get the `$hook_suffix` passed as a parameter.

 So, I'd say let's add the dynamic
 `admin_print_footer_scripts-$hook_suffix` action hook and place it right
 before its generic sibling.

 Why does one need this (kind of) hook, you ask?

 Well, the only '''dynamic''' footer action hook is
 `admin_footer-$hook_suffix`. This, however, is fired '''after'''
 `admin_print_footer_scripts`, which happens to be last chance to localize
 any scripts. If one would want to localize such a script depending on the
 current page, a dynamic variant of the action hook would come very handy.

 Attached please find a patch for this. Since the `$hook_suffix` global is
 now used twice, I ''imported'' it (at the top of the file), just like
 `/wp-admin/admin-header.php` does.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/34334>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list