钩子文档

start_previewing_theme

💡 云策文档标注

概述

start_previewing_theme 是一个 WordPress 动作钩子,在 Customizer 主题预览开始时触发。它主要用于在预览非活动主题时,通过过滤器回调动态切换主题。

关键要点

  • 这是一个动作钩子,在 Customizer 主题预览开始时触发。
  • 参数为 $manager,即 WP_Customize_Manager 实例。
  • 如果预览的主题不是活动主题,会添加过滤器回调以在运行时替换主题。
  • 自 WordPress 3.4.0 版本引入。

代码示例

do_action( 'start_previewing_theme', $this );

📄 原文内容

Fires once the Customizer theme preview has started.

Parameters

$managerWP_Customize_Manager

Source

do_action( 'start_previewing_theme', $this );

Changelog

Version Description
3.4.0 Introduced.