WP_Network_Query example

/** * Retrieves a list of networks. * * @since 4.6.0 * * @param string|array $args Optional. Array or string of arguments. See WP_Network_Query::parse_query() * for information on accepted arguments. Default empty array. * @return array|int List of WP_Network objects, a list of network IDs when 'fields' is set to 'ids', * or the number of networks when 'count' is passed as a query var. */
function get_networks( $args = array() ) {
    $query = new WP_Network_Query();

    return $query->query( $args );
}

/** * Removes a network from the object cache. * * @since 4.6.0 * * @global bool $_wp_suspend_cache_invalidation * * @param int|array $ids Network ID or an array of network IDs to remove from cache. */

                'themes'     => array(
                    'label' => __( 'The themes directory' ),
                    'value' => ( $is_writable_template_directory ? __( 'Writable' ) : __( 'Not writable' ) ),
                    'debug' => ( $is_writable_template_directory ? 'writable' : 'not writable' ),
                ),
            ),
        );

        // Conditionally add debug information for multisite setups.         if ( is_multisite() ) {
            $network_query = new WP_Network_Query();
            $network_ids   = $network_query->query(
                array(
                    'fields'        => 'ids',
                    'number'        => 100,
                    'no_found_rows' => false,
                )
            );

            $site_count = 0;
            foreach ( $network_ids as $network_id ) {
                $site_count += get_blog_count( $network_id );
            }
Home | Imprint | This part of the site doesn't use cookies.