Skip to content
Snippets Groups Projects
Commit d8da4344 authored by Erick Hitter's avatar Erick Hitter
Browse files

Fix where some actions load to keep front-end and admin methods separate. Also, uninstall!

parent 487b38ea
No related branches found
No related tags found
1 merge request!1WIP: Initial release
...@@ -70,14 +70,25 @@ class ETH_AMP_Analytics_WP { ...@@ -70,14 +70,25 @@ class ETH_AMP_Analytics_WP {
return; return;
} }
// Front-end
add_action( 'wp_loaded', array( $this, 'action_wp_loaded' ) ); add_action( 'wp_loaded', array( $this, 'action_wp_loaded' ) );
// Admin UI
add_action( 'admin_init', array( $this, 'action_admin_init' ) );
register_uninstall_hook( __FILE__, array( 'ETH_AMP_Analytics_WP', 'uninstall' ) );
} }
/** /**
* *
*/ */
public static function uninstall() {
delete_option( 'eth_amp_analytics_wp' );
}
/**
* Conditionally load front-end hooks
*/
public function action_wp_loaded() { public function action_wp_loaded() {
// Front-end
$ga_options = get_option( $this->plugin_option_name ); $ga_options = get_option( $this->plugin_option_name );
if ( is_array( $ga_options ) ) { if ( is_array( $ga_options ) ) {
...@@ -88,10 +99,6 @@ class ETH_AMP_Analytics_WP { ...@@ -88,10 +99,6 @@ class ETH_AMP_Analytics_WP {
} }
unset( $ga_options ); unset( $ga_options );
// Admin UI
add_action( 'admin_init', array( $this, 'action_admin_init' ) );
} }
/** /**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment