WordPress functions wp_enqueue_script / wp_register_script and wp_enqueue_style / wp_register_style add additional version info in the end of the JavaScript and CSS files you link (include or add) using these functions. This version info is important to ensure that the correct version of the file is sent to the browser regardless of caching.

Below screenshot explains how a version number appears in WordPress enqueued scripts and styles, see the highlighted part:

Version info shown by WordPress enqueue functions

Preventing WordPress to add version number to scripts and styles

Sometimes the version number in our scripts turns out to be unnecessary in WordPress theming and plugin projects. This article shows how to prevent WordPress adding a version number to your scripts and styles easily without adding any additional PHP functions to your theme or plugins.

Note: For DIY trials, these functions are generally used in functions.php file of your theme to link the CSS & JS files.

Take a look at the format of wp_enqueue_script function below:

<?php wp_enqueue_script( $handle, $src, $deps, $ver, $in_footer ); ?>

The functions wp_register_script, wp_enqueue_style and wp_register_style also carry the same parameters. The parameter $ver is responsible to show the version of your script or style.

If you have to specify a version to your script or style, just put the version number in single quotes in the $ver parameter. If you don’t want to specify a version, you may set it to false, but then a version number equal to the current version of WordPress will be added automatically as the version of your script or style.

In order to prevent your enqueued scripts and style in WordPress to use a version number, all you need to do is use null value in the $ver parameter. Given below is how you’ll implement it in the WordPress enqueue functions:

<?php wp_register_script('basic', plugins_url('js/basic.js', __FILE__), array(), null, true); >

Similarly, you should add the null value to the version parameter in wp_register_script, wp_enqueue_style and wp_register_style functions also. That’s it!