diff --git a/plugin-boilerplate/class-plugin-boilerplate.php b/plugin-boilerplate/class-plugin-boilerplate.php index 9754348..3a8ea2e 100644 --- a/plugin-boilerplate/class-plugin-boilerplate.php +++ b/plugin-boilerplate/class-plugin-boilerplate.php @@ -82,10 +82,6 @@ class PluginName { add_action( 'wp_enqueue_scripts', array( $this, 'register_plugin_styles' ) ); add_action( 'wp_enqueue_scripts', array( $this, 'register_plugin_scripts' ) ); - // Register hooks that are fired when the plugin is activated, deactivated, and uninstalled, respectively. - register_activation_hook( __FILE__, array( $this, 'activate' ) ); - register_deactivation_hook( __FILE__, array( $this, 'deactivate' ) ); - /* * TODO: * @@ -108,7 +104,7 @@ class PluginName { * * @param boolean $network_wide True if WPMU superadmin uses "Network Activate" action, false if WPMU is disabled or plugin is activated on an individual blog */ - public function activate( $network_wide ) { + public static function activate( $network_wide ) { // TODO: Define activation functionality here } @@ -118,7 +114,7 @@ class PluginName { * @param boolean $network_wide True if WPMU superadmin uses "Network Activate" action, false if WPMU is disabled or plugin is activated on an individual blog * @since 1.0.0 */ - public function deactivate( $network_wide ) { + public static function deactivate( $network_wide ) { // TODO: Define deactivation functionality here } diff --git a/plugin-boilerplate/plugin-boilerplate.php b/plugin-boilerplate/plugin-boilerplate.php index e1374f9..7eaf541 100644 --- a/plugin-boilerplate/plugin-boilerplate.php +++ b/plugin-boilerplate/plugin-boilerplate.php @@ -48,5 +48,10 @@ if ( ! defined( 'PLUGIN_NAME_VERSION' ) ) { // TODO: replace `class-plugin-boilerplate.php` with the name of the actual plugin's class file require_once( plugin_dir_path( __FILE__ ) . 'class-plugin-boilerplate.php' ); +// Register hooks that are fired when the plugin is activated, deactivated, and uninstalled, respectively. +// TODO: replace PluginName with the name of the plugin defined in `class-plugin-boilerplate.php` +register_activation_hook( __FILE__, array( 'PluginName', 'activate' ) ); +register_deactivation_hook( __FILE__, array( 'PluginName', 'deactivate' ) ); + // TODO: replace PluginName with the name of the plugin defined in `class-plugin-boilerplate.php` PluginName::get_instance(); \ No newline at end of file