admin_print_footer_scripts-{$hook_suffix}
云策文档标注
概述
admin_print_footer_scripts-{$hook_suffix} 是一个动态 Hook,用于在 WordPress 管理后台页面的页脚打印已排队的脚本和数据。它通过全局 hook 后缀 $hook_suffix 来指定当前页面。
关键要点
- 这是一个动态 Hook,名称中的 $hook_suffix 部分会根据当前页面的全局 hook 后缀动态变化。
- 主要用于在管理后台页面的页脚执行脚本和数据输出,常用于与 Thickbox 等工具集成。
- 自 WordPress 4.6.0 版本引入,相关函数如 iframe_footer() 在 wp-admin/includes/template.php 中定义。
代码示例
do_action( "admin_print_footer_scripts-{$hook_suffix}" ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores注意事项
- Hook 名称使用连字符而非下划线,需注意 WordPress 命名规范,代码中已添加忽略检查的注释。
- 开发者应确保 $hook_suffix 变量已正确设置,以匹配目标页面。
原文内容
Prints scripts and data queued for the footer.
Description
The dynamic portion of the hook name, $hook_suffix, refers to the global hook suffix of the current page.
Source
do_action( "admin_print_footer_scripts-{$hook_suffix}" ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
Changelog
| Version | Description |
|---|---|
| 4.6.0 | Introduced. |