WordPress Snippets at WPcustoms

Clean WordPress header remove unnecessary links

Clean up your site’s header. WordPress adds a lot of unrequired links to your html head. This function removes them.


/**
 * Snippet Name: Clean WordPress header remove unnecessary links
 * Snippet URL: https://wpcustoms.net/snippets/clean-wordpress-header-remove-unnecessary-links/
 */
  function wpc_head_cleanup() {
  remove_action('wp_head', 'feed_links', 2);
  remove_action('wp_head', 'feed_links_extra', 3);
  remove_action('wp_head', 'rsd_link');
  remove_action('wp_head', 'wlwmanifest_link');
  remove_action('wp_head', 'adjacent_posts_rel_link_wp_head', 10, 0);
  remove_action('wp_head', 'wp_generator');
  remove_action('wp_head', 'wp_shortlink_wp_head', 10, 0);
}
add_action('init', 'wpc_head_cleanup');