wpseo_deactivate

Run single site / network-wide de-activation of the plugin.

Description

wpseo_deactivate( (bool) $networkwide = false ); 

Parameters (1)

0. $networkwide — Optional. (bool) => false
Whether the plugin is being de-activated network-wide.

Usage

  1. if ( !function_exists( 'wpseo_deactivate' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'yoast-seo/wp-seo-main.php'; 
  3.  
  4. // Whether the plugin is being de-activated network-wide. 
  5. $networkwide = false; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = wpseo_deactivate($networkwide); 
  9.  

Defined (2)

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

/wp-seo-main.php  
  1. function wpseo_deactivate( $networkwide = false ) { 
  2. if ( ! is_multisite() || ! $networkwide ) { 
  3. _wpseo_deactivate(); 
  4. else { 
  5. /** Multi-site network activation - de-activate the plugin for all blogs */ 
  1. function _wpseo_deactivate() { 
  2. require_once( WPSEO_PATH . 'inc/wpseo-functions.php' ); 
  3.  
  4. if ( is_multisite() && ms_is_switched() ) { 
  5. delete_option( 'rewrite_rules' ); 
  6. else { 
  7. add_action( 'shutdown', 'flush_rewrite_rules' ); 
  8.  
  9.  
  10. // Clear cache so the changes are obvious. 
  11. WPSEO_Utils::clear_cache(); 
  12.  
  13. do_action( 'wpseo_deactivate' );