When I’m writing a fix to some bugs, I often increment the version and send it to the bug finder to see if my fix works. If I have 1.2.5 and I want to create a beta that will become redundant once I commit my code, should I use 1.2.5-beta or 1.2.6-beta? My concern is that 1.2.6 < 1.2.6-beta so that the string comparison may favour the beta and the bug finder would not get a notification of the stable version being released.

EDIT:

If the string is compared absolutely without taking into account the release type, you could use 1.2.5-fix and then 1.2.6. The problem is also outlined at http://en.wikipedia.org/wiki/Software_versioning#Pre-release_versions

2 s
2

If your current plugin version is 1.2.5, and you have a beta version for the next version, it should be called 1.2.6-beta. Your user can install it, and when the real 1.2.6 version is released on the repository, WordPress will notify the user on the Plugins page and let him update.

WordPress uses a PHP function called version_compare to compare version numbers for this purpose. When comparing version numbers, WordPress will recognize them like this:

1.2.5 < 1.2.6-beta < 1.2.6

I’ve tested this out with a plugin of my own in the repository, currently at version 0.45.11. I changed the version number of the plugin on my own site to 0.45.11-beta, and WordPress let me update to 0.45.11 from the Plugins admin page.

Leave a Reply

Your email address will not be published. Required fields are marked *