Fatal error when programmatically deactivating a plugin
-
Hi,
our user got the fatal error below when they tried to activate our WP Mail SMTP Pro version over the Lite version. We prevent that in our plugin and deactivate the Pro version automatically (in code).
PHP Fatal error: Uncaught Error: Call to undefined function get_user_by() in .../wp-content/plugins/aryo-activity-log/classes/class-aal-api.php:89
If you inspect that code you will see that you are using
get_user_by
function. But because this deactivation happens very early on in the process of WP this function is not yet defined by WP core. You’ll need to require the pluggable.php WP core file in yourinsert
function, to prevent this error from happening:require_once ABSPATH . WPINC . '/pluggable.php';
I hope you can include this fix in your upcoming plugin update.
Thank you and take care!
- The topic ‘Fatal error when programmatically deactivating a plugin’ is closed to new replies.