load-{$plugin_page}
云策文档标注
概述
load-{$plugin_page} 是一个 WordPress 钩子,在特定插件屏幕加载前触发。它主要用于直接包含文件而非使用函数的插件页面。
关键要点
- 钩子名称中的动态部分 $plugin_page 指代插件的基本名称(basename)。
- 此钩子在多种上下文中触发,适用于直接包含文件的插件屏幕。
- 相关函数:plugin_basename()。
代码示例
do_action( "load-{$plugin_page}" ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
原文内容
Fires before a particular screen is loaded.
Description
The load-* hook fires in a number of contexts. This hook is for plugin screens where the file to load is directly included, rather than the use of a function.
The dynamic portion of the hook name, $plugin_page, refers to the plugin basename.
See also
Source
do_action( "load-{$plugin_page}" ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
Changelog
| Version | Description |
|---|---|
| 1.5.0 | Introduced. |