WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 3 years ago

#21782 closed defect (bug) (invalid)

admin_print_footer_scripts action not working with wp_enqueue_script function

Reported by: alexvorn2 Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.4.1
Component: Administration Keywords:
Focuses: Cc:

Description (last modified by SergeyBiryukov)

the code I use:

function tt() {
	wp_enqueue_script('jquery-ui-accordion');
} add_action('admin_print_footer_scripts', 'tt');

the jquery-ui-accordion is not loaded in the footer.

Change History (5)

#1 follow-up: @SergeyBiryukov
3 years ago

  • Description modified (diff)
  • Keywords 2nd-opinion needs-patch removed

admin_print_footer_scripts is too late for enqueueing. This is when _wp_footer_scripts() is called, so only the styles included earlier will be printed.

Use admin_footer instead.

#2 in reply to: ↑ 1 @alexvorn2
3 years ago

Replying to SergeyBiryukov:

admin_print_footer_scripts is too late for enqueueing. This is when _wp_footer_scripts() is called, so only the styles included earlier will be printed.

Use admin_footer instead.

then for what is this function? I thought it is designed for calling user files through wp_enqueue_script function

Version 0, edited 3 years ago by alexvorn2 (next)

#3 follow-up: @SergeyBiryukov
3 years ago

admin_print_footer_scripts action is used to print the default scripts followed by custom scripts that were earlier enqueued for the footer:
http://make.wordpress.org/core/2009/01/15/optimizing-script-loading-implementation/

#4 in reply to: ↑ 3 @alexvorn2
3 years ago

Replying to SergeyBiryukov:

admin_print_footer_scripts action is used to print the default scripts followed by custom scripts that were earlier enqueued for the footer:
http://make.wordpress.org/core/2009/01/15/optimizing-script-loading-implementation/

Thanks!

#5 @SergeyBiryukov
3 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.