New answers tagged

2

Method 1 You can use activate_plugin() and deactivate_plugins() to activate/deactivate plugins programmatically. If you want to control the time at which those actions happen, then you can use wp_schedule_event() too. Method 2 I know you asked about PHP, but if you have WP-CLI installed on your server, you can also write a script that uses wp plugin ...


0

//Using this code you can activate your plugin from the functions.php function activate_plugin_via_php() { $active_plugins = get_option( 'active_plugins' ); array_push($active_plugins, 'unyson/unyson.php'); /* Here just replace unyson plugin directory and plugin file*/ update_option( 'active_plugins', $active_plugins ); } ...


-1

Write This Code On theme Function.php 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( '...



Top 50 recent answers are included