wp-content/mu-plugins/ とかに入れておこう!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: Just do it ! | |
Plugin URI: | |
Description: | |
Version: 0.1 | |
Author: | |
Author URI: | |
*/ | |
new just_do_it(); | |
class just_do_it { | |
private $must_plugins = array( | |
'WP Multibyte Patch' => 'wp-multibyte-patch/wp-multibyte-patch.php', | |
); | |
function __construct() { | |
add_action('shutdown', array($this, 'plugins_loaded')); | |
} | |
public function plugins_loaded() { | |
$activePlugins = get_option('active_plugins'); | |
foreach ($this->must_plugins as $key => $plugin) { | |
if ( !array_search($plugin, $activePlugins) ) { | |
activate_plugin( $plugin, '', $this->is_multisite() ); | |
} | |
} | |
} | |
private function is_multisite() { | |
return function_exists('is_multisite') && is_multisite(); | |
} | |
} |
コメントを残す