The admin_print_footer_scripts action hook is the last chance to localize adminadmin (and super admin) scripts; but it is a generic one. If you ever wanted to do something for specific admin pages only, you would either have to hook into another dynamic action, or hook into admin_print_footer_scripts and check the $hook_suffix (which is not even passed, but that’s not an issue) yourself. The problem with the former is that there might be happening a lot between the chosen action and when your script gets enqueued (admin_print_footer_scripts); and maybe you need to be aware of what has happened. The problem with the latter is that you would have to register possibly a lot of functions, maybe check the current admin page inside several of these, and eventually bail most of the times. That’s why WordPress 4.6 brings the dynamic footer action admin_print_footer_scripts-$hook_suffix. See [37279].
The following pre-4.6 code
add_action( 'admin_print_footer_scripts', function() {
global $hook_suffix;
if ( 'some_admin_page' !== $hook_suffix ) {
return;
}
// Whatever it is that you want to do...
} );
can now be simplified like this:
add_action( 'admin_print_footer_scripts-some_admin_page', function() {
// Whatever it is that you want to do...
} );
This change brings more consistency between wp-admin/admin-footer.php and wp-admin/admin-header.php, which already fires the generic admin_print_scripts and the dynamic admin_print_scripts-$hook_suffix actions.
For more background on the change, see #34334.