钩子文档

customize_save_{$id_base}

💡 云策文档标注

概述

customize_save_{$id_base} 是一个 WordPress 动态 Hook,在 WP_Customize_Setting::save() 方法被调用时触发,用于在自定义设置保存过程中执行自定义操作。

关键要点

  • 这是一个动态 Hook,其名称中的 $id_base 部分对应设置名称的基础 slug。
  • Hook 接收一个参数:$setting,即 WP_Customize_Setting 实例。
  • 主要用于在保存自定义设置时添加自定义逻辑,例如验证或处理数据。
  • 首次引入于 WordPress 3.4.0 版本。

代码示例

do_action( "customize_save_{$id_base}", $this );

📄 原文内容

Fires when the WP_Customize_Setting::save() method is called.

Description

The dynamic portion of the hook name, $id_base refers to the base slug of the setting name.

Parameters

$settingWP_Customize_Setting

Source

do_action( "customize_save_{$id_base}", $this );

Changelog

Version Description
3.4.0 Introduced.