WordPress: Remove generator meta tags for AMP Plugin

Need Some Help? We are here for you!

We have a very friendly service - Come and chat to us and let us know what you need, we work for an hourly fee and can also provide you a no obligation quote and begin work immediately in most cases. Click "Request Support" or use our Live Chat.

Request Support

This is a mobile optimized version of this page, view original page.

WordPress AMP plugin by Automattic is a great plugin for adding a seamless AMP version of your WordPress blog, one thing we noticed which we was not happy about was the fact that it adds 2 meta tags into the header of the AMP pages, one pointing out that your using the AMP plugin with version number and another pointing out your using WordPress and the version number, both tags are not only completely USELESS but could present a serious security concern as your basically telling everyone what your site is running under with version number and also what AMP plugin your using with version number making it easy to focus penetration through any known vulnerabilities that might exist at present or in future.

This is what they look like in the source code:

<meta name="generator" content="AMP Plugin v1.5.0; mode=reader">
<meta name="generator" content="WordPress 5.3.2">

 

Fortunately you can remove both meta tags very easily by adding this code into the functions.php file of your theme:

<?php
// Remove AMP generator meta tag and WordPress generator tag on AMP.
add_action( 'amp_post_template_head', 'isa_remove_amp_generator_meta_tag', 2 );
function isa_remove_amp_generator_meta_tag() {
    remove_action( 'amp_post_template_head', 'amp_add_generator_metadata' ); 
	remove_action('amp_post_template_head', 'wp_generator');
}
?>

 

Alternatively you could install our AMP ToolBox for WordPress plugin, which not only removes these for you without editing your functions file, but also gives you other options such as the ability to set-up your header logo on AMP pages and change some other features.

Need Some Help? We are here for you!

We have a very friendly service - Come and chat to us and let us know what you need, we work for an hourly fee and can also provide you a no obligation quote and begin work immediately in most cases. Click "Request Support" or use our Live Chat.

Request Support

SHARING IS CARING!


Author: Dean Williams

Professional PHP Web Developer with expertise in OpenCart Web Development, WordPress Web Development, Bespoke Systems - also a seasoned Linux Server Administrator.