wpseo_network_activate_deactivate

Run network-wide (de-)activation of the plugin.

Description

wpseo_network_activate_deactivate( (bool) $activate = true ); 

Parameters (1)

0. $activate — Optional. (bool) => true
True for plugin activation, false for de-activation.

Usage

  1. if ( !function_exists( 'wpseo_network_activate_deactivate' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'yoast-seo/wp-seo-main.php'; 
  3.  
  4. // True for plugin activation, false for de-activation. 
  5. $activate = true; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = wpseo_network_activate_deactivate($activate); 
  9.  

Defined (1)

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

/wp-seo-main.php  
  1. function wpseo_network_activate_deactivate( $activate = true ) { 
  2. global $wpdb; 
  3.  
  4. $network_blogs = $wpdb->get_col( $wpdb->prepare( "SELECT blog_id FROM $wpdb->blogs WHERE site_id = %d", $wpdb->siteid ) ); 
  5.  
  6. if ( is_array( $network_blogs ) && $network_blogs !== array() ) { 
  7. foreach ( $network_blogs as $blog_id ) { 
  8. switch_to_blog( $blog_id ); 
  9.  
  10. if ( $activate === true ) { 
  11. else { 
  12.  
  13. restore_current_blog();