wp_maybe_update_network_user_counts

函式
wp_maybe_update_network_user_counts ( $network_id = null )
引數
  • (int|null) $network_id ID of the network. Default is the current network.
    Required:
    Default: null
定義位置
相關方法
wp_maybe_update_network_site_countswp_update_network_user_countswp_maybe_update_user_countswp_update_network_site_countswp_maybe_update_network_site_counts_on_update
引入
3.7.0
棄用
-

wp_maybe_update_network_user_counts: 這個函式用於更新網路中的使用者數。它檢查計數是否是最新的,如果不是,它就更新計數。

更新全網使用者數。

如果通過{@see ‘enable_network_counts’}過濾器啟用,當一個使用者被建立或其狀態被更新時,更新網路上的使用者數。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
function wp_maybe_update_network_user_counts( $network_id = null ) {
$is_small_network = ! wp_is_large_network( 'users', $network_id );
/** This filter is documented in wp-includes/ms-functions.php */
if ( ! apply_filters( 'enable_live_network_counts', $is_small_network, 'users' ) ) {
return;
}
wp_update_network_user_counts( $network_id );
}
function wp_maybe_update_network_user_counts( $network_id = null ) { $is_small_network = ! wp_is_large_network( 'users', $network_id ); /** This filter is documented in wp-includes/ms-functions.php */ if ( ! apply_filters( 'enable_live_network_counts', $is_small_network, 'users' ) ) { return; } wp_update_network_user_counts( $network_id ); }
function wp_maybe_update_network_user_counts( $network_id = null ) {
	$is_small_network = ! wp_is_large_network( 'users', $network_id );

	/** This filter is documented in wp-includes/ms-functions.php */
	if ( ! apply_filters( 'enable_live_network_counts', $is_small_network, 'users' ) ) {
		return;
	}

	wp_update_network_user_counts( $network_id );
}

常見問題

FAQs
檢視更多 >