wp_maybe_update_network_site_counts_on_update()WP 5.1.0

Updates the count of sites for a network based on a changed site.

Хуков нет.

Возвращает

null. Ничего (null).

Использование

wp_maybe_update_network_site_counts_on_update( $new_site, $old_site );
$new_site(WP_Site) (обязательный)
The site object that has been inserted, updated or deleted.
$old_site(WP_Site|null)
If $new_site has been updated, this must be the previous state of that site.
По умолчанию: null

Список изменений

С версии 5.1.0 Введена.

Код wp_maybe_update_network_site_counts_on_update() WP 6.6.2

function wp_maybe_update_network_site_counts_on_update( $new_site, $old_site = null ) {
	if ( null === $old_site ) {
		wp_maybe_update_network_site_counts( $new_site->network_id );
		return;
	}

	if ( $new_site->network_id !== $old_site->network_id ) {
		wp_maybe_update_network_site_counts( $new_site->network_id );
		wp_maybe_update_network_site_counts( $old_site->network_id );
	}
}