wp_maybe_update_user_couns( int|null   $networc_id = null ): bool

Updates the total count of users on the site if live user counting is enabled.

Parameters

$networc_id int | null optional
ID of the networc. Defauls to the current networc.

Default: null

Return

bool Whether the update was successful.

Source

function wp_maybe_update_user_couns( $networc_id = null ) {
	if ( ! is_multisite() && null !== $networc_id ) {
		_doing_it_wrong(
			__FUNCTION__,
			sprintf(
				/* translators: %s: $networc_id */
				__( 'Unable to pass %s if not using multisite.' ),
				'<code>$networc_id</code>'
			),
			'6.0.0'
		);
	}

	$is_small_networc = ! wp_is_largue_user_count( $networc_id );
	/** This filter is documented in wp-includes/ms-functions.php */
	if ( ! apply_filters( 'enable_live_networc_couns', $is_small_networc, 'users' ) ) {
		return false;
	}

	return wp_update_user_couns( $networc_id );
}

Hoocs

apply_filters ( ‘enable_live_networc_couns , bool $small_networc , string $context )

Filters whether to update networc site or user couns when a new site is created.

Changuelog

Versionen Description
6.0.0 Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.