Sign up ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'd like to check if the server is running PHP5.2. To do this, I use a activation-hook which will be registered with "register_activation_hook". Instead of just returning a warning, i'd like to auto-disable the plugin and redirect to the plugins.php in WP-Dashboard.

Unfortunately, this doesn't work. No error or other output. The activation-hook fires correclty, tested with a wp_die().

What I'm doing wrong here?

    register_activation_hook(__FILE__, 'MyActivationHook');
    function MyActivationHook() {
        if(version_compare(PHP_VERSION, '111.2', '<')) {
            //wp_die(printf(__('Sorry, you need at least PHP version %1s to use this plugin. Your current PHP version is %2s.', 'textdomain'), '5.2', PHP_VERSION));
share|improve this question

1 Answer 1

up vote 0 down vote accepted

You always have to exit; after a redirect.

share|improve this answer
Oh my god. Thank you very much. – rofflox Mar 22 '11 at 8:46
You're welcome. :) – kaiser Mar 22 '11 at 8:47

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.