How to control initial wp_head() output?

Here is the current list of actions that is currently hooked by default to wp_head

Reposted here to avoid unnecessary opening multiple browser windows

add_action( 'wp_head',             '_wp_render_title_tag',            1     );
add_action( 'wp_head',             'wp_enqueue_scripts',              1     );
add_action( 'wp_head',             'feed_links',                      2     );
add_action( 'wp_head',             'feed_links_extra',                3     );
add_action( 'wp_head',             'rsd_link'                               );
add_action( 'wp_head',             'wlwmanifest_link'                       );
add_action( 'wp_head',             'adjacent_posts_rel_link_wp_head', 10, 0 );
add_action( 'wp_head',             'locale_stylesheet'                      );
add_action( 'wp_head',             'noindex',                          1    );
add_action( 'wp_head',             'print_emoji_detection_script',     7    );
add_action( 'wp_head',             'wp_print_styles',                  8    );
add_action( 'wp_head',             'wp_print_head_scripts',            9    );
add_action( 'wp_head',             'wp_generator'                           );
add_action( 'wp_head',             'rel_canonical'                          );
add_action( 'wp_head',             'wp_shortlink_wp_head',            10, 0 );
add_action( 'wp_head',             'wp_site_icon',                    99    );

if ( isset( $_GET['replytocom'] ) )
    add_action( 'wp_head', 'wp_no_robots' );

You can remove any action with remove_action()

remove_action( 'wp_head', 'wp_print_styles, 8 );

Just remember, an action need to be removed with the same priority it was added.

As bonus, check this epic post from @ChristineCooper on how to remove emojicons

EDIT

An important note here. The foillowing actions should not be removed as this causes serious issues with how stylesheets and scripts are loaded

  • locate_stylesheet

  • wp_print_styles

  • wp_generator

  • wp_enqueue_scripts

If you need something specific removed, rather remove the call back function with remove_action or use the specific functions allocated to remove styles and scripts

Leave a Comment