Self deactivate plugins after an action occurs
The deactivate_plugins() function is available only after the admin_init action is executed, you will either need to register ‘admin_init’ filter and run the deactivate_plugins() function there or manually include the wp-admin/includes/plugin.php file. I updated your code with the second solution below. class WP_X_Plugin{ public function __construct(){ register_activation_hook( __FILE__, array( $this , ‘activate’ ) ); $url … Read more