How To Remove Meta Tags in WordPress

  1. Documentation
  2. Performance
  3. How To Remove Meta Tags in WordPress

What Meta Tags Are and How They Affect Website Performance

The most obvious and precise definition of meta is “data that provides information about another data”. The <meta> tag provides metadata about website page. It is used for entering keywords, author, last modified date, page description, etc. Many website owners remove meta tags in WordPress.

Metadata is not displayed in pages. But it is important for browsers, search engines, and other web services. However, each code has meta tags that cause negative effects. It causes performance issues and slows down page load. So it’s better to remove meta tags in WordPress. Here are the general meta tags types:

  1. RSD Links. Internet services use RSD links to edit websites or publish posts remotely. Even though inbuilt in CMS by default, very few users actually use it. If you don’t use RSD links consider disabling the feature.
  2. XFN Profile (XHTML Friends Network). This is a microformat for social interactions in blogs. For example, links for friends & partners websites.
  3. Wlwmanifest Link. This is a link for Windows live writer – the blog editor. However, if you are not familiar with this service you probably publish articles without any external software.
  4. Short links. If you use permalinks and logical URLs for each post, then short links are something you don’t really need. They are full of technical data and duplicated features.

Meta Tags Help Hackers To Find Vulnerabilities On Your Website

Imagine this: a robber tries to break into your house. He is trying to find a proper key. And he finds details about the brand and model of the lock written right on the front door. It means that the robber can pick a lock faster and get inside the house.

Original metadata helps to find what CMS you use on a website. The same applies to WordPress. Knowing that it’s a WordPress-based website, a hacker can add “wp-admin” at the end of the main URL and sort the password.

The old WordPress version used the “admin” login for the administrator account. And most website owners don’t change the login name. Thus, hackers can find the WordPress version in the meta generator tag and sort the password for the “admin” user. They can also find other vulnerabilities based on the WordPress version.

WordPress.org posts a list of security breaches for each version of CMS. Hackers can use it to get access to your website. And all of this happens because of seeing one single line. So it’s better to remove meta tags in WordPress.

 How To Remove Meta Tags in WordPress?

 Disable Meta tags With the Clearfy plugin

Download and install a free Clearfy plugin and remove meta tags in WordPress in a few clicks. This module performs dozens of optimization tasks. But now we are highly interested in a particular one – disabling meta tags.

You can work with the plugin from the admin dashboard. Go to Settings => Clearfy menu.

How To Remove Meta Tags in WordPress?

Click on Clearfy menu => Performance. All options you need to disable are marked with the red rectangle below.

How To Remove Meta Tags in WordPress?

We’ve mentioned meta tag functions at the beginning of the article: RSD links, short links, Wlwmanifest Link, and XFN (XHTML Friends Network) profile. Press ON next to each of the feature marked with red to activate it.

How To Remove Meta Tags in WordPress?

We recommend you to check other Clearfy features from the Performance section. They improve security, SEO, etc. Pay attention to multicolor options with “?”. Point a cursor at them to see tooltips.

You can see performance improvements right after the plugin activation. The image below shows GTmetrix testing results for a classic WordPress website.

BEFORE using Clearfy shows that page load is 2.6 sec.

How To Remove Meta Tags in WordPress?

AFTER disabling meta tags using the plugin:

How To Remove Meta Tags in WordPress?

Page speed has increased on 0.3 seconds. It is a notable improvement in terms of optimization.

Remove Meta Tags in WordPress With the Code

You can get rid of tag generation once and for all using the code. All you need to do is to modify functions.php in the WordPress theme root folder and add the following lines before the closing ?>:

// Remove meta generator tags in WordPress
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');
}

Let’s see what this code does:

  • Line #1 – simple comment to describe what code does.
  • Line #2 – creates a function that returns a void string.
  • Lines #4-9 – WordPress executes them with different methods to display content, search for generator tag and replace it with a void string from Line #2.

Other changes posted online remove the generator tag from pages and messages only by using the following line in functions.php:

remove_action ('wp_head', 'wp_generator');

This works great for simple corrections. But there are other ways of displaying your website content in WordPress: RSS feeds, export, comments, etc. All these methods may include the generator tag. And the line above doesn’t affect it at all.

The functions.php File Is Missing

If functions.php is missing (yes, sometimes that happens!) you should create it manually in the theme folder. Make sure it has a valid format and opening/closing PHP tags.

The full code for this fix in the functions.php file is listed below:

<? PHP
// Remove WordPress generator metadata
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');
}
?>

Do not overwrite existing functions.php. If you do have functions.php then modify it and add the code.

Conclusion

We’ve shown you two ways how to remove meta tags in WordPress: free plugin and modification of functions.php. Obviously, the first option is faster, easier and safer. Plus you don’t need any coding skills to do it. In addition, you can significantly improve both the performance and security of your website. If you spend time and money on optimization then it’s better to improve all figures with a free plugin.