can_edit_network

Whether or not we can edit this network from this page.

Description

can_edit_network( (int) $site_id ); 

By default editing of network is restricted to the Network Admin for that $site_id this allows for this to be overridden.

Parameters (1)

0. $site_id (int)
The network/site ID to check.

Usage

  1. if ( !function_exists( 'can_edit_network' ) ) { 
  2. require_once ABSPATH . '/wp-admin/includes/ms.php'; 
  3.  
  4. // The network/site ID to check. 
  5. $site_id = -1; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = can_edit_network($site_id); 
  9.  

Defined (1)

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

/wp-admin/includes/ms.php  
  1. function can_edit_network( $site_id ) { 
  2. global $wpdb; 
  3.  
  4. if ( $site_id == $wpdb->siteid ) 
  5. $result = true; 
  6. else 
  7. $result = false; 
  8.  
  9. /** 
  10. * Filters whether this network can be edited from this page. 
  11. * @since 3.1.0 
  12. * @param bool $result Whether the network can be edited from this page. 
  13. * @param int $site_id The network/site ID to check. 
  14. */ 
  15. return apply_filters( 'can_edit_network', $result, $site_id );