monsterinsights_ajax_deactivate_addon

Deactivates a MonsterInsights addon.

Description

monsterinsights_ajax_deactivate_addon(); 

Usage

  1. if ( !function_exists( 'monsterinsights_ajax_deactivate_addon' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'google-analytics-for-wordpress-by-monsterinsights/includes/admin/ajax.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = monsterinsights_ajax_deactivate_addon(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/includes/admin/ajax.php  
  1. function monsterinsights_ajax_deactivate_addon() { 
  2.  
  3. // Run a security check first. 
  4. check_ajax_referer( 'monsterinsights-deactivate', 'nonce' ); 
  5.  
  6. if ( ! current_user_can( 'activate_plugins' ) ) { 
  7. echo json_encode( true ); 
  8.  
  9. // Deactivate the addon. 
  10. if ( isset( $_POST['plugin'] ) ) { 
  11. if ( isset( $_POST['isnetwork'] ) && $_POST['isnetwork'] ) {  
  12. $deactivate = deactivate_plugins( $_POST['plugin'], false, true ); 
  13. } else { 
  14. $deactivate = deactivate_plugins( $_POST['plugin'] ); 
  15.  
  16. echo json_encode( true ); 
  17. wp_die();