Removing the WP Version – There’s More

Categories: Blog, Development, WordPress
Tags: , , , ,

Aug 5

A while back I mentioned the best method for Removing the WordPress Version and it appears I overlooked something.  First, let me say that the previous article is still correct and you should still use the code provided. However, while working on a new plugin I noticed something that previously slipped my mind:


If you plan to register and enqueue a script using the wp_register_script() and wp_enqueue_script() functions you should be aware that if you do not include a version in wp_register_script() that WordPress will include a version for you.  The version used is your current WordPress version.

This is not a huge issue if the script being registered is only being used in the admin section. But if it appears anywhere else on your WordPress site you have two options.

First, you can set the version number of the script (in cases where you know the version number).

Secondly, you can set the version to ‘NULL‘ – in which case WordPress will not include a version number.

Example Images

The following example images are from my test server to show you where the WordPress version is placed.

WordPress Version used in Script Version

WordPress Version used in Script Version

WordPress Version omitted from Script Version

WordPress Version omitted from Script Version

As you can clearly see from the first image, where I did not include a version when using wp_register_script(), the version of WordPress I am running is used (version 3.2.1). With the second image I set the version to NULL when using wp_register_script().

When possible I highly recommend you use the appropriate version of the script rather than using NULL. If it’s a script you’ve written then it’s good practice to assign a version – it’s better for tracking for yourself as well as for testing in case the browser caches the script (among other reasons).



Leave a comment


Leave a comment

Read comments


Please do not submit your comment more than once. It will appear once it has been approved.