Skip to content

Instantly share code, notes, and snippets.

@uxmoon
Last active August 3, 2017 13:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save uxmoon/07e581daa6f18d63217ed1d20933a3fa to your computer and use it in GitHub Desktop.
Save uxmoon/07e581daa6f18d63217ed1d20933a3fa to your computer and use it in GitHub Desktop.
WordPress clean <head> code
function wp_head_cleanup () {
  remove_action('wp_head', 'wp_generator');
  remove_action('wp_head', 'wlwmanifest_link');
  remove_action('wp_head', 'rsd_link');
  remove_action('wp_head', 'wp_shortlink_wp_head');

  remove_action('wp_head', 'adjacent_posts_rel_link_wp_head', 10);

  add_filter('the_generator', '__return_false');
  add_filter('show_admin_bar','__return_false');

  remove_action( 'wp_head', 'print_emoji_detection_script', 7 );
  remove_action( 'wp_print_styles', 'print_emoji_styles' );
}
add_action('after_setup_theme', 'wp_head_cleanup');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment