钩子文档

do_mu_upgrade

💡 云策文档标注

概述

do_mu_upgrade 是一个 WordPress 过滤器,用于控制是否执行多站点数据库升级例程。在单站点中,用户会被重定向到 wp-admin/upgrade.php;而在多站点环境中,升级例程仅在过滤器返回 true 时自动触发。

关键要点

  • do_mu_upgrade 过滤器决定是否执行多站点数据库升级例程,默认值为 true。
  • 在多站点中,如果网络站点数不超过 50,升级例程每次都会运行;否则会进行节流以减少负载。
  • 该过滤器在 WordPress MU 3.0.0 版本中引入,适用于多站点环境。

代码示例

if ( apply_filters( 'do_mu_upgrade', true ) ) {
    // 执行多站点升级例程的代码
}

📄 原文内容

Filters whether to attempt to perform the multisite DB upgrade routine.

Description

In single site, the user would be redirected to wp-admin/upgrade.php.
In multisite, the DB upgrade routine is automatically fired, but only when this filter returns true.

If the network is 50 sites or less, it will run every time. Otherwise, it will throttle itself to reduce load.

Parameters

$do_mu_upgradebool
Whether to perform the Multisite upgrade routine. Default true.

Source

if ( apply_filters( 'do_mu_upgrade', true ) ) {

Changelog

Version Description
MU (3.0.0) Introduced.