Title: Feature Request: WordPress version number remove
Last modified: March 30, 2024

---

# Feature Request: WordPress version number remove

 *  Resolved [cheahcs](https://wordpress.org/support/users/cheahcs/)
 * (@cheahcs)
 * [2 years, 2 months ago](https://wordpress.org/support/topic/feature-request-wordpress-version-number-remove/)
 * It is better have a toggle button to switch on the Remove or Hide WordPress version
   number feature in the security section.

Viewing 8 replies - 1 through 8 (of 8 total)

 *  [DJABHipHop](https://wordpress.org/support/users/pressthemes1/)
 * (@pressthemes1)
 * [2 years, 2 months ago](https://wordpress.org/support/topic/feature-request-wordpress-version-number-remove/#post-17541183)
 * dotto
 *  [DJABHipHop](https://wordpress.org/support/users/pressthemes1/)
 * (@pressthemes1)
 * [2 years, 2 months ago](https://wordpress.org/support/topic/feature-request-wordpress-version-number-remove/#post-17549020)
 * Try This
 *     ```wp-block-code
       function wpcode_snippet_remove_query_strings_split( $src ) {
       	$output = preg_split( "/(&ver|\\?ver)/", $src );
   
       	return $output ? $output[0] : '';
       }
   
       add_action( 'init', function () {
       	if ( ! is_admin() ) {
       		add_filter( 'script_loader_src', 'wpcode_snippet_remove_query_strings_split', 15 );
       		add_filter( 'style_loader_src', 'wpcode_snippet_remove_query_strings_split', 15 );
       	}
       } );
       ```
   
    -  This reply was modified 2 years, 2 months ago by [DJABHipHop](https://wordpress.org/support/users/pressthemes1/).
 *  [Bri](https://wordpress.org/support/users/tinnyfusion/)
 * (@tinnyfusion)
 * [2 years, 2 months ago](https://wordpress.org/support/topic/feature-request-wordpress-version-number-remove/#post-17549224)
 * Just out of curiosity, why do you need all that code to just remove the version
   number?.. There are simpler snippets.
 *  [DJABHipHop](https://wordpress.org/support/users/pressthemes1/)
 * (@pressthemes1)
 * [2 years, 2 months ago](https://wordpress.org/support/topic/feature-request-wordpress-version-number-remove/#post-17558125)
 * Its build in to aes but does not work
    -  This reply was modified 2 years, 2 months ago by [DJABHipHop](https://wordpress.org/support/users/pressthemes1/).
 *  Thread Starter [cheahcs](https://wordpress.org/support/users/cheahcs/)
 * (@cheahcs)
 * [2 years, 2 months ago](https://wordpress.org/support/topic/feature-request-wordpress-version-number-remove/#post-17678761)
 * Yes, I just find out the remove WP version in the disable component section. 
   Thks.
 *  [DJABHipHop](https://wordpress.org/support/users/pressthemes1/)
 * (@pressthemes1)
 * [2 years, 1 month ago](https://wordpress.org/support/topic/feature-request-wordpress-version-number-remove/#post-17700014)
 * Try this to improve security & increase performance
 *     ```wp-block-code
       /**
   
        * Remove the 'type="text/css"' attribute from stylesheet link tags.
   
        *
   
        * @param string $tag The complete HTML tag for the stylesheet.
   
        * @param string $handle The name of the stylesheet.
   
        * @param string $src The URL of the stylesheet file.
   
        * @return string The modified HTML tag for the stylesheet.
   
        */
   
       function preload_css($tag, $handle, $src){
   
           return str_replace('type="text/css"', "", $tag);
   
       }
   
       add_filter('style_loader_tag', 'preload_css', 10, 3);
   
       /**
   
        * Remove the 'type="text/javascript"' attribute from script link tags.
   
        *
   
        * @param string $tag The complete HTML tag for the script.
   
        * @param string $handle The name of the script.
   
        * @param string $src The URL of the script file.
   
        * @return string The modified HTML tag for the script.
   
        */
   
       function preload_script($tag, $handle, $src){
   
           return str_replace('type="text/javascript"', "", $tag);
   
       }
   
       add_filter('script_loader_tag', 'preload_script', 10, 3);
   
       /**
   
        * Remove query strings from script and style URLs.
   
        *
   
        * @param string $src The URL of the script or style.
   
        * @return string The URL without query strings.
   
        */
   
       function wpcode_snippet_remove_query_strings_split($src) {
   
           $output = preg_split( "/(&ver|\\?ver)/", $src ); // Split the URL by '&ver' or '?ver'
   
           return $output ? $output[0] : ''; // Return the URL without query strings
   
       }
   
       add_filter('script_loader_src', 'wpcode_snippet_remove_query_strings_split', 15);
   
       add_filter('style_loader_src', 'wpcode_snippet_remove_query_strings_split', 15);
   
       function add_async_defer($tag, $handle, $src) {
   
           return "<script async='async' defer='defer' src='".$src."'></script>";
   
       }
   
       add_filter('script_loader_tag', 'add_async_defer', 10, 3);
       ```
   
 *  [DJABHipHop](https://wordpress.org/support/users/pressthemes1/)
 * (@pressthemes1)
 * [2 years, 1 month ago](https://wordpress.org/support/topic/feature-request-wordpress-version-number-remove/#post-17701861)
 * Skip this line as breaks the back end
 *     ```wp-block-code
       add_filter('script_loader_tag', 'add_async_defer', 10, 3); 
       ```
   
 *  Thread Starter [cheahcs](https://wordpress.org/support/users/cheahcs/)
 * (@cheahcs)
 * [2 years, 1 month ago](https://wordpress.org/support/topic/feature-request-wordpress-version-number-remove/#post-17701961)
 * Thks, I will try this code snippet.

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘Feature Request: WordPress version number remove’ is closed to new replies.

 * ![](https://ps.w.org/admin-site-enhancements/assets/icon-256x256.png?rev=3099794)
 * [Admin and Site Enhancements (ASE)](https://wordpress.org/plugins/admin-site-enhancements/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/admin-site-enhancements/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/admin-site-enhancements/)
 * [Active Topics](https://wordpress.org/support/plugin/admin-site-enhancements/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/admin-site-enhancements/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/admin-site-enhancements/reviews/)

 * 8 replies
 * 3 participants
 * Last reply from: [cheahcs](https://wordpress.org/support/users/cheahcs/)
 * Last activity: [2 years, 1 month ago](https://wordpress.org/support/topic/feature-request-wordpress-version-number-remove/#post-17701961)
 * Status: resolved