Meta generator tag in WordPress reveals the plugin or WordPress core version which makes WordPress vulnerable. So, here i list snippets to disable meta tag generator by various plugins.

Remove WordPress & Woocommerce meta tag generator

This code will disable meta tag generated by WordPress, Woocommerce and many other standard plugins that hook up with the wp_generator action.

remove_action('wp_head', 'wp_generator');
add_filter( 'the_generator', '__return_null' );

Remove meta generator tag of revslider plugin

// remove revslider meta generator tag
add_filter( 'revslider_meta_generator', '__return_empty_string' );

Remove meta generator tag of wpbakery page builder plugin

// remove wpbakery visual_composer meta generator tag
add_action('wp_head', 'wpboys_remove_vc_metadata', 1);
function wpboys_remove_vc_metadata() {
  if ( class_exists( 'Vc_Manager' ) ) {
	remove_action('wp_head', array(visual_composer(), 'addMetaData'));
  }
}

Remove meta generator tag of sitepress wpml plugin

// remove wpml meta generator tag
if ( !empty ( $GLOBALS['sitepress'] ) ) {
        function wpboys_remove_wpml_generator() {
            remove_action(
                current_filter(),
                array ( $GLOBALS['sitepress'], 'meta_generator_tag' )
            );
        }
        add_action( 'wp_head', 'wpboys_remove_wpml_generator', 0 );
    }

Complete code Snippet to remove meta generator tags from your WordPress Website

// Disable meta generator tags
// author : wpboys
remove_action('wp_head', 'wp_generator');
add_filter( 'the_generator', '__return_null' );
// remove revslider meta generator tag
add_filter( 'revslider_meta_generator', '__return_empty_string' );
// remove wpbakery visual_composer meta generator tag
add_action('wp_head', 'wpboys_remove_vc_metadata', 1);
function wpboys_remove_vc_metadata() {
  if ( class_exists( 'Vc_Manager' ) ) {
	remove_action('wp_head', array(visual_composer(), 'addMetaData'));
  }
}
// remove wpml meta generator tag
if ( !empty ( $GLOBALS['sitepress'] ) ) {
        function wpboys_remove_wpml_generator() {
            remove_action(
                current_filter(),
                array ( $GLOBALS['sitepress'], 'meta_generator_tag' )
            );
        }
        add_action( 'wp_head', 'wpboys_remove_wpml_generator', 0 );
    }

Remove generator tags from Feed

WordPress-based website feeds have a generator tag that reveals the WordPress core version. You can remove the generator tag using the following code :

    remove_action( 'rss2_head', 'the_generator' );
    remove_action( 'rss_head',  'the_generator' );
    remove_action( 'rdf_header', 'the_generator' );
    remove_action( 'atom_head', 'the_generator' );
    remove_action( 'commentsrss2_head', 'the_generator' );
    remove_action( 'opml_head', 'the_generator' );
    remove_action( 'app_head',  'the_generator' );
    remove_action( 'comments_atom_head', 'the_generator' );