钩子文档

customize_post_value_set_{$setting_id}

💡 云策文档标注

概述

此文档介绍 WordPress 自定义器中的 customize_post_value_set_{$setting_id} Hook,它在特定设置的未清理发布值被设置时触发,主要用于开发者监控或修改自定义器设置值。

关键要点

  • Hook 名称:customize_post_value_set_{$setting_id},其中 {$setting_id} 是动态部分,指代设置 ID。
  • 触发时机:当 WP_Customize_Manager::set_post_value() 方法被调用时触发。
  • 参数:$value(未清理的设置发布值,类型为 mixed)和 $manager(WP_Customize_Manager 实例)。
  • 相关函数:WP_Customize_Manager::set_post_value(),用于在当前自定义状态中覆盖设置值。
  • 版本历史:自 WordPress 4.4.0 版本引入。

📄 原文内容

Announces when a specific setting’s unsanitized post value has been set.

Description

Fires when the WP_Customize_Manager::set_post_value() method is called.

The dynamic portion of the hook name, $setting_id, refers to the setting ID.

Parameters

$valuemixed
Unsanitized setting post value.
$managerWP_Customize_Manager

Source

do_action( "customize_post_value_set_{$setting_id}", $value, $this );

Changelog

Version Description
4.4.0 Introduced.