функция since 3.3.0

wp_is_large_network()

Проверено на WordPress 6.9, обновлено Источник: WordPress Developer Resources.

Сигнатура

wp_is_large_network( string $using = 'sites', int|null $network_id = null ): bool

Описание

По умолчанию крупной считается сеть, в которой более 10 000 пользователей или более 10 000 сайтов.
Плагины могут изменить этот критерий с помощью фильтра ‘wp_is_large_network’.

Оригинал (английский)

The default criteria for a large network is either more than 10,000 users or more than 10,000 sites.
Plugins can alter this criteria using the ‘wp_is_large_network’ filter.

Параметры

$using string необязательный = 'sites'
'sites' или 'users'. Значение по умолчанию — 'sites'.
$network_id int|null необязательный = null
ID сети. По умолчанию — текущая сеть.

Возвращаемое значение

bool

Исходный код

wp-includes/ms-functions.php:2707

function wp_is_large_network( $using = 'sites', $network_id = null ) {
	$network_id = (int) $network_id;
	if ( ! $network_id ) {
		$network_id = get_current_network_id();
	}

	if ( 'users' === $using ) {
		$count = get_user_count( $network_id );

		$is_large_network = wp_is_large_user_count( $network_id );

		/**
		 * Filters whether the network is considered large.
		 *
		 * @since 3.3.0
		 * @since 4.8.0 The `$network_id` parameter has been added.
		 *
		 * @param bool   $is_large_network Whether the network has more than 10000 users or sites.
		 * @param string $component        The component to count. Accepts 'users', or 'sites'.
		 * @param int    $count            The count of items for the component.
		 * @param int    $network_id       The ID of the network being checked.
		 */
		return apply_filters( 'wp_is_large_network', $is_large_network, 'users', $count, $network_id );
	}

	$count = get_blog_count( $network_id );

	/** This filter is documented in wp-includes/ms-functions.php */
	return apply_filters( 'wp_is_large_network', $count > 10000, 'sites', $count, $network_id );
}

История изменений

ВерсияОписание
4.8.0 The $network_id parameter has been added.
3.3.0 Introduced.

Что будем искать? Например,Продвижение

Этот сайт использует куки-файлы. Оставаясь на сайте, Вы соглашаетесь на их использование. Для получения дополнительной информации, пожалуйста, ознакомьтесь с политикой в отношении персональных данных.