I am going to show you how to remove the WordPress generator tag by commenting out the code within the wp_head function.
– Removing the tag at it’s source can improve performance. You will not have to use a plugin to remove a tag after it has been generated by WordPress.
– The file that creates the generator tag can change when you upgrade WordPress to a different version. When the file is changed the call to create the function will not be commented out, which means you will have to go through this process again.
Navigate to your WordPress installation folder and find the default-filters.php file (WordPress > wp-includes > default-filters.php).