wp_get_network

The timeline below displays how wordpress function wp_get_network has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 6.1

/**
 * Retrieves an object containing information about the requested network.
 *
 * @since 3.9.0
 * @deprecated 4.7.0 Use get_network()
 * @see get_network()
 *
 * @internal In 4.6.0, converted to use get_network()
 *
 * @param object|int $network The network's database row or ID.
 * @return WP_Network|false Object containing network information if found, false if not.
 */
function wp_get_network($network)
{
    _deprecated_function(__FUNCTION__, '4.7.0', 'get_network()');
    $network = get_network($network);
    if (null === $network) {
        return false;
    }
    return $network;
}

WordPress Version: 4.7

/**
 * Retrieve an object containing information about the requested network.
 *
 * @since 3.9.0
 * @deprecated 4.7.0 Use `get_network()`
 * @see get_network()
 *
 * @internal In 4.6.0, converted to use get_network()
 *
 * @param object|int $network The network's database row or ID.
 * @return WP_Network|false Object containing network information if found, false if not.
 */
function wp_get_network($network)
{
    _deprecated_function(__FUNCTION__, '4.7.0', 'get_network()');
    $network = get_network($network);
    if (null === $network) {
        return false;
    }
    return $network;
}

WordPress Version: 4.6

/**
 * Retrieve an object containing information about the requested network.
 *
 * @since 3.9.0
 *
 * @internal In 4.6.0, converted to use get_network()
 *
 * @param object|int $network The network's database row or ID.
 * @return WP_Network|false Object containing network information if found, false if not.
 */
function wp_get_network($network)
{
    $network = get_network($network);
    if (null === $network) {
        return false;
    }
    return $network;
}

WordPress Version: 4.4

/**
 * Retrieve an object containing information about the requested network.
 *
 * @since 3.9.0
 * @since 4.4.0 Converted to leverage WP_Network
 *
 * @param object|int $network The network's database row or ID.
 * @return WP_Network|false Object containing network information if found, false if not.
 */
function wp_get_network($network)
{
    if (!is_object($network)) {
        $network = WP_Network::get_instance($network);
    } else {
        $network = new WP_Network($network);
    }
    return $network;
}

WordPress Version: 4.3

/**
 * Retrieve an object containing information about the requested network.
 *
 * @since 3.9.0
 *
 * @global wpdb $wpdb
 *
 * @param object|int $network The network's database row or ID.
 * @return object|false Object containing network information if found, false if not.
 */
function wp_get_network($network)
{
    global $wpdb;
    if (!is_object($network)) {
        $network = $wpdb->get_row($wpdb->prepare("SELECT * FROM {$wpdb->site} WHERE id = %d", $network));
        if (!$network) {
            return false;
        }
    }
    return $network;
}

WordPress Version: 3.9

/**
 * Retrieve an object containing information about the requested network.
 *
 * @since 3.9.0
 *
 * @param object|int $network The network's database row or ID.
 * @return object|bool Object containing network information if found, false if not.
 */
function wp_get_network($network)
{
    global $wpdb;
    if (!is_object($network)) {
        $network = $wpdb->get_row($wpdb->prepare("SELECT * FROM {$wpdb->site} WHERE id = %d", $network));
        if (!$network) {
            return false;
        }
    }
    return $network;
}