public function map_meta_cap( $caps, $cap, $user_id, $args ) {

		// Map our meta capabilities to primitive capabilities first.
		switch ( $cap ) {
			case 'edit_network':
				$caps = array( 'manage_networks' );
				break;
			case 'delete_network':
				$caps = array( 'delete_networks' );
				break;
		}

		// Check for primitive global capabilities.
		$required_global_caps = array_intersect( $caps, $this->get_global_capabilities() );
		if ( empty( $required_global_caps ) ) {
			return $caps;
		}

		// Check if the user has access to global capabilities.
		if ( ! $this->has_user_global_access( $user_id ) ) {
			$caps[] = 'do_not_allow';
		}

		return $caps;
	}
public function map_meta_cap( $caps, $cap, $user_id, $args ) {

		// Map our meta capabilities to primitive capabilities first.
		switch ( $cap ) {
			case 'edit_network':
				$caps = array( 'manage_networks' );
				break;
			case 'delete_network':
				$caps = array( 'delete_networks' );
				break;
		}

		// Check for primitive global capabilities.
		$required_global_caps = array_intersect( $caps, $this->get_global_capabilities() );
		if ( empty( $required_global_caps ) ) {
			return $caps;
		}

		// Check if the user has access to global capabilities.
		if ( ! $this->has_user_global_access( $user_id ) ) {
			$caps[] = 'do_not_allow';
		}

		return $caps;
	}
public function map_meta_cap ( $ caps , $ cap , $ user_id , $ args ) { // Map our meta capabilities to primitive capabilities first. switch ( $ cap ) { case 'edit_network' : $ caps = array ( 'manage_networks' ) ; break ; case 'delete_network' : $ caps = array ( 'delete_networks' ) ; break ; } // Check for primitive global capabilities. $ required_global_caps = array_intersect ( $ caps , $ this -> get_global_capabilities ( ) ) ; if ( empty ( $ required_global_caps ) ) { return $ caps ; } // Check if the user has access to global capabilities. if ( ! $ this -> has_user_global_access ( $ user_id ) ) { $ caps [ ] = 'do_not_allow' ; } return $ caps ; }
Ensures only global administrators have access to global capabilities.

@since 2.3.0

@param array  $caps    Array of required capabilities.
@param string $cap     Capability to map.
@param int    $user_id User ID.
@param array  $args    Additional context for the capability check.
@return array Filtered required capabilities.
Ensures only global administrators have access to global capabilities .