Make WordPress Core

Opened 7 years ago

Closed 7 years ago

#7720 closed defect (bug) (fixed)

default-filters.php missing add_action('wp_head', 'wp_print_styles')

Reported by: rickoman Owned by:
Milestone: 2.7 Priority: normal
Severity: normal Version: 2.6.1
Component: General Keywords:
Focuses: Cc:


wp_enqueue_scripts has a corresponding add_action('wp_head', 'wp_print_scripts') so that enqueued scripts are automatically emitted in the document head.

But wp_enqueue_styles are not emitted automatically because a call to add_action('wp_head', 'wp_print_styles') is missing from default-filters.php.

The add_action for styles should be placed above the print scripts (or with a priority of 9) so that css styles are emitted before javascipt as recommended by YSlow.

add_action('wp_head', 'wp_print_styles', 9);
add_action('wp_head', 'wp_print_scripts');

Note the admin screens do hook wp_print_styles and emit styles correctly

add_action('admin_print_scripts', 'wp_print_scripts', 20);
add_action('admin_print_styles', 'wp_print_styles', 20);

Change History (1)

comment:1 @ryan7 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [8854]) Add wp_print_styles to wp_head. Props rickoman. fixes #7720

Note: See TracTickets for help on using tickets.