I have these tags:
<meta name="generator" content="Woo Framework Version 3.1.1" />
<meta name="generator" content="WordPress 3.5" />
<meta name="generator" content="Canvas 3.0" />
I understand to remove the WordPress version tag I add:
remove_action( 'wp_head', 'wp_generator' ); // goes into functions.php
But how do I remove the themes meta
tags?
If you are trying only to remove the
meta="generator"
add this line to your functions.php.Was looking for a solution for removing Layer Slider meta generator, didn’t find much help on any of the handful of websites I looked at, they are all sharing the same info, which only pertains to either WordPress generator or popular plugins like WooCommerce.
The problem here is that every plugin is going to have it’s own hook names and naming conventions, so to learn or know them all will be nearly impossible. The easiest way I think is plain PHP with
preg_replace
.Working code that has been tested in WordPress 4.7.2.
Inside functions.php of your theme drop in this code and it should work.
I am using regular expression to capture the
meta
tag. It covers whether they put spaces in between the equals sign or not. Usingob_start
to cover the whole document. So we add thepreg_replace
starting at the header all the way to the footer. See howob_start
works in the PHP Manual, also there are times WordPress codex does states it should be usingob_start
.If you find this useful please add a thumbs up so the next person looking can land on a working solution that covers all meta generators. I feel it’s bad security for these plugin and platform developers to put meta generator version numbers in the code. Especially with evolving vulnerabilities being discovered all the time.
Ive also added a plugin that does this exact thing on the WordPress repository.
Remove Meta Generators
At the bottom of the functions.php file add this following php snippet:
I recently ran into this issue, and had to remove the meta tags for security and spam reasons for a client. I was able to remove WordPress’s meta generator but the theme uses woo framework so using
Is not sufficient. To remove
and anything any meta generator tags that your theme generates simply add this line to the end of your template’s functions.php
This worked for me on Woo Framework 5.5.5. To locate where the generator meta tag is initialized, look for your
admin-init.php
file for your template andwoo_version()
function andwoo_version_init()
function should be there. Usually its under the includes folder within your theme source.I found this source code of a plugin which states that it removes the auto-generated WP meta tags. You could try that.
NO!
In case if it is hardcoded into your theme’s template (i.e. in header.php),then you have to manually remove that!
Otherwise, use this full solution, to remove all version tags:
The following code gets rid of all generator tags in the Woo Framework. I have tested it with Woo Framework 6.0.4 and the theme Canvas 5.8.3:
Here is the plugin which will remove WP meta and version removal:
https://wordpress.org/plugins/wp-meta-and-version-remover/
This one finds the sitekit by Google, but can be modified for anything. Thanks to this article and his plugin.
If you made your ouw custom WordPress theme, there will be no problem with generator in meta, DO like i Did in samll sample. There will be no generator, if you will not declare it like some of your custom functions. I try to control all JS scripts and Styles of my theme like here.
If i have, style from plugins, there some more Job needed.
but if you use, free theme, yes in 100% there will be generator.
So add in File Function.php 1: http://sierra-group.in.ua/start-legkogo-rezhima-preprocesornoj-sborki-vashih-fajlov-stilej-i-skriptov.html/#custom-register-styles-sctiprs