WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 5 years ago

#9560 closed defect (bug) (wontfix)

do_action sequence in admin-footer.php

Reported by: arena Owned by: azaozz
Milestone: Priority: normal
Severity: normal Version: 2.8
Component: Administration Keywords: has-patch dev-feedback
Focuses: Cc:

Description

the current sequence is :
do_action('admin_footer', );
do_action('admin_print_footer_scripts');
do_action("admin_footer-$hook_suffix");

shouldn't it be

do_action("admin_footer-$hook_suffix");
do_action('admin_print_footer_scripts');
do_action('admin_footer', );

Attachments (1)

9560.patch (483 bytes) - added by Viper007Bond 5 years ago.

Download all attachments as: .zip

Change History (10)

Viper007Bond5 years ago

comment:1 follow-up: Viper007Bond5 years ago

  • Component changed from General to Administration
  • Keywords has-patch added
  • Priority changed from high to normal
  • Version set to 2.8

Yes, the generic hook should come last. Attached patch matches the order of the header.

comment:2 in reply to: ↑ 1 ; follow-up: arena5 years ago

Sorry but the right sequence should be :

do_action("admin_footer-$hook_suffix");
do_action('admin_print_footer_scripts');
do_action('admin_footer', );

comment:3 in reply to: ↑ 2 ; follow-up: Viper007Bond5 years ago

Erm, why? I went off the order that the header has it in:

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');

comment:4 in reply to: ↑ 3 arena5 years ago

Replying to Viper007Bond:

Erm, why? I went off the order that the header has it in:

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');

ok !

comment:5 arena5 years ago

Anyone to commit this patch ? thank you !

comment:6 ryan5 years ago

  • Owner changed from anonymous to azaozz

comment:7 Denis-de-Bernardy5 years ago

If I add a script in one particular page to override WP scripts, I'd *much* rather than the hook-specific hook fires after, personally.

comment:8 Denis-de-Bernardy5 years ago

  • Keywords dev-feedback added

comment:9 azaozz5 years ago

  • Milestone 2.8 deleted
  • Resolution set to wontfix
  • Status changed from new to closed

In the footer scripts have to be printed after all content, just before the </body> tag. Also as Denis mentions running do_action("admin_footer-$hook_suffix"); last allows overwriting any previously defined js function.

Note: See TracTickets for help on using tickets.