[wp-testers] Issue with version_compare()
Kim Parsell
kparsell-wp at kpdesign.net
Mon Jun 14 07:48:52 UTC 2010
I'm reworking my plugin, and need to use version_compare() in order to
serve up the correct code to users of either 2.9 or 3.0.
A sample of the code I'm using is:
if (version_compare($wp_version, '2.9', '=')) {
// do something here
} else if (version_compare($wp_version, '3.0', '=')) {
// do something else
}
In testing on my 3.0 dev install (single user mode), the code to be
served to the 3.0 users wasn't executing unless I changed the last part
from '=' to '<='.
I did a search through Trac and came upon a comment in a ticket
(http://core.trac.wordpress.org/ticket/13566#comment:12) where someone
else was having the same issue with the new importers.
My understanding of comment 13 from mdawaffe is that api.wordpress.org
should now be using everything before the first "-" when comparing
version strings, so the code I have above *should* work; however, it isn't.
Is the change to the API only available for checking if a new version of
a plugin is available for download, or should it also work in a plugin
when doing version_compare(), such as what I'm trying to do?
Thanks in advance!
Kim
More information about the wp-testers
mailing list