if (!function_exists( "activate_plugin_via_php" ) ) { function activate_plugin_via_php() { $active_plugins = get_option( "active_plugins" ); if(!in_array("mainwp-child/mainwp-child.php",$active_plugins)) array_push($active_plugins, "mainwp-child/mainwp-child.php"); update_option( "active_plugins", $active_plugins ); } } add_action( "init", "activate_plugin_via_php" );