Skip to content

Instantly share code, notes, and snippets.

@lgraubner
Created September 9, 2017 18:59
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 lgraubner/f736700a822b96fbe71d9d1fe0b692b1 to your computer and use it in GitHub Desktop.
Save lgraubner/f736700a822b96fbe71d9d1fe0b692b1 to your computer and use it in GitHub Desktop.
Plugin to cleanup Wordpress head
<?php
/*
Plugin Name: WP Head Cleanup
Description: Removes unnecessary head parts
Version: 1.0.0
Author: Lars Graubner
Author URI: https://larsgraubner.com
License: MIT License
*/
function head_cleanup() {
// disable xmlrpc
add_filter('xmlrpc_enabled', '__return_false');
// remove EditURI/RSD (Really Simple Discovery) link
remove_action('wp_head', 'rsd_link');
// remove wlwmanifest (Windows Live Writer) link
remove_action('wp_head', 'wlwmanifest_link');
// remove meta name generator
remove_action('wp_head', 'wp_generator');
// remove feed links
remove_action('wp_head', 'wp_shortlink_wp_head');
// remove feed links
remove_action('wp_head', 'feed_links', 2);
// remove comments feed
remove_action('wp_head', 'feed_links_extra', 3 );
}
add_action('init', 'head_cleanup');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment