• Hey folks.

    I’ve just installed 2.6-beta1. In order to test plugin compatibilities, I used the version_compare php function. I’d like to insert some code in 2.6-beta1 but not in 2.5.1. I’ve tried this:

    if ( version_compare( $wp_version, '2.6', '>=' ) ) {
      // some code
    }

    but the code doesnt execute in 2.6-beta1. The version_compare did work a hundred times on other parts of the code.

    Don’t I see the wood for the trees?

    edit. Since actually 2.6-beta1 is earlier than 2.6, I’ve also tried

    if ( version_compare( $wp_version, '2.5.9', '>=' ) ) {
      // some code
    }

    but that didnt work either.

    Regards.

Viewing 4 replies - 1 through 4 (of 4 total)
  • because $wp_version = '2.6-beta1'; I think it is the ‘-beta1’ that is causing the problem.

    Thread Starter wpseek

    (@alphawolf)

    Considered the same. So, I cant pre-test “version-comparing” until 2.6 stable has been released?

    Disregard my previous comment

    if ( version_compare('2.6-beta1', '2.6-alpha1', '>=' ) ) {
    echo 'true 1';
    }
    if ( version_compare('2.6-beta1', '2.5.9', '>=' ) ) {
    echo 'true 2';
    }
    if ( version_compare('2.6-beta1', '2.6', '>=' ) ) {
    echo 'true 3';
    }

    Results: true 1true 2

    It does work for me.

    Thread Starter wpseek

    (@alphawolf)

    Whoops. Sorry, brain fart. $wp_version wasnt set and filled. 🙂

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘WP version compare with beta snapshots’ is closed to new replies.