钩子文档

enable_live_network_counts

💡 云策文档标注

概述

enable_live_network_counts 是一个 WordPress 过滤器,用于控制在创建新站点时是否更新网络站点或用户计数。它通常与 wp_is_large_network() 函数关联,用于优化大型网络的性能。

关键要点

  • 过滤器名称:enable_live_network_counts
  • 用途:过滤是否在创建新站点时更新网络站点或用户计数
  • 参数:$small_network(布尔值,表示网络是否被视为小型)和 $context(字符串,上下文,可以是 'users' 或 'sites')
  • 相关函数:wp_maybe_update_user_counts(), wp_maybe_update_network_site_counts(), wp_maybe_update_network_user_counts()
  • 引入版本:WordPress 3.7.0

代码示例

if ( ! apply_filters( 'enable_live_network_counts', $is_small_network, 'sites' ) ) {
    // 代码逻辑
}

📄 原文内容

Filters whether to update network site or user counts when a new site is created.

Description

See also

Parameters

$small_networkbool
Whether the network is considered small.
$contextstring
Context. Either 'users' or 'sites'.

Source

if ( ! apply_filters( 'enable_live_network_counts', $is_small_network, 'sites' ) ) {

Changelog

Version Description
3.7.0 Introduced.