PHP: Активация плагинов

способ №1

function run_activate_plugin( $plugin ) {
    $current = get_option( 'active_plugins' );
    $plugin = plugin_basename( trim( $plugin ) );

    if ( !in_array( $plugin, $current ) ) {
        $current[] = $plugin;
        sort( $current );
        do_action( 'activate_plugin', trim( $plugin ) );
        update_option( 'active_plugins', $current );
        do_action( 'activate_' . trim( $plugin ) );
        do_action( 'activated_plugin', trim( $plugin) );
    }

    return null;
}
run_activate_plugin( 'akismet/akismet.php' );

способ №2

// Define the new plugin you want to activate
$plugin_path = '/path/to/your/new/plugin.php';
// Get already-active plugins   
$active_plugins = get_option('active_plugins');
// Make sure your plugin isn't active
if (isset($active_plugins[$plugin_path]))
    return;

// Include the plugin.php file so you have access to the activate_plugin() function
require_once(ABSPATH .'/wp-admin/includes/plugin.php');
// Activate your plugin
activate_plugin($plugin_path);