钩子文档

customize_controls_print_scripts

💡 云策文档标注

概述

customize_controls_print_scripts 是一个 WordPress 动作钩子,在主题定制器屏幕的 <head> 部分打印脚本时触发。它类似于 wp_head 钩子,但仅适用于主题定制器界面。

关键要点

  • 此钩子在主题定制器屏幕的 <head> 部分触发,用于打印控制脚本。
  • 默认情况下,print_head_scripts() 函数以优先级 20 添加到此钩子。
  • 与 wp_head 钩子功能类似,但仅影响主题定制器屏幕;通常建议在主题定制 API 中使用 wp_head 钩子。
  • 源调用为 do_action( 'customize_controls_print_scripts' )。
  • 从 WordPress 3.4.0 版本引入。

注意事项

如果需要在页脚打印脚本,可以使用 customize_controls_print_footer_scripts 钩子。


📄 原文内容

Fires when Customizer control scripts are printed.

More Information

The customize_controls_print_scripts action hook is triggered within the section of the theme customizer screen. By default, the function print_head_scripts() is added to this action with a priority of 20.

This hook functions similarly to the wp_head action hook, but only affects the theme customizer screen. Generally, when using the Theme Customization API, you are better off hooking into wp_head instead.

Source

do_action( 'customize_controls_print_scripts' );

Changelog

Version Description
3.4.0 Introduced.

User Contributed Notes