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

Wordpress 3.3 has deprecated the add_contextual_help() functions and it's filters, so in order to continue supporting 3.0 - 3.2.1 and also comply with 3.3, I have done the following:

global $wp_version;
if ($wp_version >= '3.3') {
    // New method
    add_action("load-$admin_page", 'CrayonSettingsWP::help_screen');
} else {
    // Depreciated method
    add_filter('contextual_help', 'CrayonSettingsWP::cont_help', 10, 3);

Is there a better approach?

share|improve this question
If they have a codex entry, then you'll find their newer version or an alternate function. If not a codex entry, then simply check their source files (I use Netbeans on Windows, hence ctrl+click opens up the source file), you'll see an alternative method in the comments. – Rutwick Gangurde Dec 11 '11 at 7:28
up vote 5 down vote accepted

I don't see anything wrong with your approach. But I'm going to take a different track: don't support older versions of WP.

The general impression I've gotten from the WP community is one of progress. By supporting the current version and forward you're helping to push the community towards using the most up to date version of WordPress.

Excerpted from WordPress Plugin Development (which is a great book!):

In the WordPress development community, backward compatibility may sometimes be even looked down upon. Users are expected to stay updated with the latest version of the software.

share|improve this answer
This is probably the best way to go, eventually, once 3.3 is released I'll probably let everyone know that they will have to update or use the older version of my plugin. – Aram Kocharyan Dec 11 '11 at 22:59

Better for your version check is that you use the default functions of PHP for this requirement; see the example.

if ( version_compare( $GLOBALS['wp_version'], '3.3alpha', '>=' ) ) {

The version in PHP is more as the 3 strings, liek 3.3! that it is important to check for versions smaller the stable release.

share|improve this answer

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.