WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm unable to devine what's causing my theme to crash in WP 2.9.2, although I know its something in my query statement below, so I need to do a version check for (version) < 3 to branch it.

What is the method to get the currently installed WP version? - I'm just using "wp_version" as a stand in :)

if(wp_version < 3)
    $myqueryTopMenu = '';
    $myqueryTopMenu = new WP_Query();$myqueryTopMenu->query(array('cat' => "$cat,-$catHidden",'post_not_in' => get_option('sticky_posts')));
share|improve this question
up vote 5 down vote accepted

get_bloginfo( 'version' )

Other version globals can be found in wp-includes/version.php

Also, it's safer to use PHP's version_compare().

share|improve this answer
Thanks for the help scribu! – Scott B Feb 14 '11 at 5:55
Found out a better way. See updated answer. – scribu Feb 16 '11 at 9:36

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.