• PROBLEM

    The plugin correctly removes the meta information added by WordPress generator, which appears in the code as follows:

    <meta name=”generator” content=”WordPress x.y.z” />

    where “x”, “y” and “z” indicates WordPress version.

    But, there is another situation where meta information may be added to the code: when you load an external script or css, using the WordPress functions wp_enqueue_script, wp_register_script, wp_enqueue_style an wp_register_style (there is a good article about that in: https://w3bits.com/wordpress-enqueue-functions-version/).

    The problem is that this sort of meta info is not removed from the code by the plugin. So, this feature seems to be incomplete.

    SOLUTION

    Add new instructions to the code to also remove this type of meta info.
    This approach appears in an article here:
    https://www.virendrachandak.com/techtalk/how-to-remove-wordpress-version-parameter-from-js-and-css-files/
    There is also a plugin where both meta info information are removed:
    https://www.ads-software.com/plugins/meta-generator-and-version-info-remover/

    EXAMPLE OF MODIFIED CODE

    if($aio_wp_security->configs->get_value('aiowps_remove_wp_generator_meta_info') == '1'){
    	add_filter('the_generator', array(&$this,'remove_wp_generator_meta_info'));
    	// remove css  and js meta info (1 of 2)
    	// +++++ start of added code +++++
    	add_filter( 'style_loader_src', array(&$this,'remove_wp_css_js_meta_info'));
    	add_filter( 'script_loader_src', array(&$this,'remove_wp_css_js_meta_info'));
    	// +++++ end of added code +++++
    }
    
    //
    // some lines of code bellow
    //
    
    function remove_wp_generator_meta_info()
    {
    	return '';
    }
    // remove css  and js meta info (2 of 2)
    // +++++ start of added code +++++
    function remove_wp_css_js_meta_info($src) {
    	if (strpos($src, 'ver=')) {
    		$src = remove_query_arg('ver', $src);
    	}
    	return $src;
    }
    // +++++ end of added code +++++

    Perhaps you wil have to modify the title of this feature, from “WP generator Meta Info” to “WP Generator, CSS and JS Meta Info”

    https://www.ads-software.com/plugins/all-in-one-wp-security-and-firewall/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter aldemarcalazans

    (@aldemarcalazans)

    By the way: in my particular case, the problen arised after I installed a WPMU DEV plugin called SITE CATEGORIES. To reproduce the problem, just install this plugin. You will see something like the following, appearing in the code:

    <link rel=’stylesheet’ id=’site-categories-styles-css’ href=’https://localhost/yoursite/wp-content/plugins/site-categories/css/site-categories-styles.css?ver=3.6.1&#8242; type=’text/css’ media=’all’ />

    Plugin Contributor mbrsolution

    (@mbrsolution)

    Hi aldemarcalazans one of the developers will look into this issue for you. However I can’t find that plugin you mention above

    WPMU DEV plugin called SITE CATEGORIES.

    can you share a link so the developers can do more testing.

    Thank you

    Plugin Contributor wpsolutions

    (@wpsolutions)

    @aldemarcalazans,
    Thanks for the suggestion and proposed solution.

    That is why this feature is called “WP Generator Meta Tag” because that’s all it does, ie, it simply removes the Wp generator meta tags from the “head” section of the html code.

    However your suggestion is a good one and we will put it in our list of future improvements for the plugin.

    Thread Starter aldemarcalazans

    (@aldemarcalazans)

    Hi guys.

    The link for the cited plugin is:
    https://premium.wpmudev.org/project/site-categories/
    But this is a paid plugin, so it will be dificult to get it for free, even for a test.

    But, fortunately, I found a simpler way to visualize the problem of CSS/JS loading showing meta info inside the code: just install WordPress 3.9.2 and then press CTRL+U with the main page opened. You will see the following line of code:

    <link rel=’stylesheet’ id=’twentyfourteen-style-css’ href=’https://localhost/wordpress/wp-content/themes/twentyfourteen/style.css?ver=3.9.2&#8242; type=’text/css’ media=’all’ />

    The version information showed above can be removed by the code presented in this post. Of course, one good idea would be check/investigate about possible side effects of this approach, before including it in the plugin code.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Still seeing WP meta information in the code’ is closed to new replies.