Still seeing WP meta information in the code
-
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/
- The topic ‘Still seeing WP meta information in the code’ is closed to new replies.