钩子文档

customize_preview_{$this->type}

💡 云策文档标注

概述

customize_preview_{$this->type} 是一个 WordPress 动态 Hook,在 WP_Customize_Setting::preview() 方法被调用时触发,专门用于处理非 theme_mods 或 options 类型的设置。

关键要点

  • 这是一个动态 Hook,其名称中的 $this->type 部分根据设置类型动态变化。
  • 触发时机:当 WP_Customize_Setting::preview() 方法被调用,且设置类型不是 theme_mods 或 options 时。
  • 参数:$setting,一个 WP_Customize_Setting 实例。
  • 相关函数:WP_Customize_Setting::preview(),用于在访问设置值时添加过滤器。
  • 版本历史:从 WordPress 4.1.0 版本引入。

📄 原文内容

Fires when the WP_Customize_Setting::preview() method is called for settings not handled as theme_mods or options.

Description

The dynamic portion of the hook name, $this->type, refers to the setting type.

Parameters

$settingWP_Customize_Setting

Source

do_action( "customize_preview_{$this->type}", $this );

Changelog

Version Description
4.1.0 Introduced.