Join WhatsApp ChannelJoin Now

How to Remove Version Number In WordPress

Today, i we will show you remove version number in WordPress. This article will give you simple example of remove version number in WordPress. you will learn remove version number in WordPress. So let’s follow few step to create example of remove version number in WordPress.

Example 1

Remove WordPress version number from WP_Head

<?php
   function remove_or_hide_wordpress_version_number() {
        return '';
   }
   add_filter('the_generator', 'remove_or_hide_wordpress_version_number');
?>

Example 2

Removes WordPress version number from all enqueued or included CSS and JS files

<?php
function remove_or_hide_wordpress_version_number( $src ) {
       if ( strpos( $src, 'ver=' ) )
           $src = remove_query_arg( 'ver', $src );
       return $src;
   }
   add_filter( 'style_loader_src', 'remove_or_hide_wordpress_version_number', 9999 );
   add_filter( 'script_loader_src', 'remove_or_hide_wordpress_version_number', 9999 );
?>

Example 3

Remove all wordpress version number from all enqueued.

<?php
function remove_or_hide_wordpress_version_number( $src ) {
       if ( strpos( $src, 'ver=' . get_bloginfo( 'version' ) ) )
           $src = remove_query_arg( 'ver', $src );
       return $src;
   }
   add_filter( 'style_loader_src', 'remove_or_hide_wordpress_version_number', 9999 );
   add_filter( 'script_loader_src', 'remove_or_hide_wordpress_version_number', 9999 );
?>

Recommended Posts