If you were wondering how to remove unnecessary meta tags added to HTML source code of your wordpress site, then here’s how you can do that. By default wordpress adds few meta tags and link tags to HTML source code (such as wordpress version, manifest and rsd), that are not used mostly. Moreover, wordpress meta tag can let others know the version of CMS that you are currently running and you know hackers love such information.
Here’s a sample meta and link tag added by wordpress,
<meta name="generator" content="WordPress 2.3.3" />
<link rel="EditURI" type="application/rsd+xml" title="RSD" href="http://kannadahanigalu.com/xmlrpc.php?rsd" />
<link rel="wlwmanifest" type="application/wlwmanifest+xml" href="http://kannadahanigalu.com/wp-includes/wlwmanifest.xml" />
To remove meta tag and link tag from the HTML source of your wordpress site, add the below lines to your theme function.php file.
remove_action( 'wp_head', 'wp_generator' ) ;
remove_action( 'wp_head', 'wlwmanifest_link' ) ;
remove_action( 'wp_head', 'rsd_link' ) ;
Update: If the above code didn’t work for you, then you may try the alternate solution – add the below code to functions.php in your theme directory
function remove_generator_filter() { return ''; } if (function_exists('add_filter')) { $types = array('html', 'xhtml', 'atom', 'rss2', /*'rdf',*/ 'comment', 'export'); foreach ($types as $type) add_filter('get_the_generator_'.$type, 'remove_generator_filter'); }
You can also use a plugin to remove it and many more stuff from the header (and disable unwanted widgets). There are some, but I use this one:
https://wordpress.org/plugins/remove-wp-overhead/