[wp-trac] [WordPress Trac] #10529: API to retrieve current WordPress version

WordPress Trac wp-trac at lists.automattic.com
Sat Aug 1 10:39:06 UTC 2009


#10529: API to retrieve current WordPress version
---------------------------+------------------------------------------------
 Reporter:  stephanreiter  |       Owner:               
     Type:  enhancement    |      Status:  new          
 Priority:  normal         |   Milestone:  2.9          
Component:  Plugins        |     Version:               
 Severity:  minor          |    Keywords:  version query
---------------------------+------------------------------------------------
 Sometimes it's necessary in plug-ins to check whether a certain
 functionality or behavior is supported by the current WP version or not.
 For this purpose I currently use the following code in the Scissors
 plugin:

 {{{
 function _minimalWpVersion($major, $minor) {
   global $wp_version;
   $version = preg_replace("/[^\\.0-9\s]/", "", $wp_version); // keep only
 '0' .. '9' and '.'
   $version = explode('.', $version);
   return (count($version) >= 2 && ($version[0] > $major || $version[0] ==
 $major && $version[1] >= $minor));
 }
 }}}

 I would love to see the introduction of an API that allows plug-in authors
 to easily query the current version of WordPress and get a result in the
 form of an array('major' => 2, 'minor' => 8, 'revision' => 2) (to give an
 example). This would eliminate potential problems when the format of the
 version-string changed.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/10529>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list