Remote plugin activation hook

Use activate_plugin() instead:

activate_plugin( $plugin, $redirect="", $network_wide = false, $silent = false )

You need just the first parameter, the same value as in the option.

This function will call the necessary actions:

if ( ! $silent ) {
    do_action( 'activate_plugin', $plugin, $network_wide );
    do_action( 'activate_' . $plugin, $network_wide );
}

Note: depending on where you call activate_plugin function you might need to add this:

 include_once( ABSPATH . 'wp-admin/includes/plugin.php' );

Leave a Comment

error code: 523