In my plugin, I am doing a minimum-supported PHP version compatibility check via a function bound to register_activation_hook and halting activation for those on PHP version less than the minimum supported PHP version. But the other functions in the main plugin file are also called during above compatibility check and since a couple of them have code that is not compatible with older PHP version, it results in a fatal error message instead of showing an intended message(your PHP version is not supported) on activation. So the question here is, why do other functions in the main file get called before the call to function bound to register_activation_hook?

  • 1
    if it's invalid syntax for the current php version, it'll trigger a fatal error no matter where it is in the file- the function that contains the code doesn't have to be called. – Milo May 23 '18 at 3:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.