[wp-hackers] How to determine which WordPress version is running ?

Viper007Bond viper at viper007bond.com
Sat Jan 20 13:38:16 GMT 2007


I find this to be best:


global $wp_db_version;
if ( 3664 <= $wp_db_version ) die('Your version is too low.'); // Change the
"3664" to whatever revision you wanna check for


Unlike $wp_version, $wp_db_version is always an integer with no letters
making it the easiest to compare to. You can also go exactly to the revision
number which added the needed function (so that'll it'll work on new beta
builds on 2.1, but not old beta builds).

On 1/20/07, Alex Günsche <ag.ml2007 at zirona.com> wrote:
>
> On Sat, 2007-01-20 at 13:05 +0100, Per Soderlind wrote:
> > In my plugin, I need to determine which WordPress version it's installed
> on.
> > What is the best method for doing this ?
> > Using # $wp_version ? Or using function_exists on a function I now only
> > exist in WordPress 2.1 or later ? i.e.
> function_exists('wp_print_scripts')
>
> How about <?php get_bloginfo('version') ?> ;-)
>
>
> Best regards
> Alex
>
> --
> Alex Günsche, Zirona OpenSource-Consulting
> work: http://www.zirona.com/ | leisure: http://www.roggenrohl.net
> PubKey for this address: http://www.zirona.com/misc/ag.ml2007.asc
>
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>



-- 
Viper007Bond | http://www.viper007bond.com/


More information about the wp-hackers mailing list