钩子文档

update_site_option

💡 云策文档标注

概述

update_site_option 是一个 WordPress Hook,在网络选项值成功更新后触发。它允许开发者在网络选项变更时执行自定义操作。

关键要点

  • 触发时机:网络选项值成功更新后
  • 参数:$option(选项名称)、$value(当前值)、$old_value(旧值)、$network_id(网络ID)
  • 相关函数:update_network_option() 用于更新已添加的网络选项值
  • 版本变更:WordPress 4.7.0 添加了 $network_id 参数,3.0.0 引入此 Hook

📄 原文内容

Fires after the value of a network option has been successfully updated.

Parameters

$optionstring
Name of the network option.
$valuemixed
Current value of the network option.
$old_valuemixed
Old value of the network option.
$network_idint
ID of the network.

Source

do_action( 'update_site_option', $option, $value, $old_value, $network_id );

Changelog

Version Description
4.7.0 The $network_id parameter was added.
3.0.0 Introduced.