network_admin_plugin_action_links_{$plugin_file}
云策文档标注
概述
network_admin_plugin_action_links_{$plugin_file} 是一个 WordPress 过滤器钩子,用于在 Network Admin 插件列表页面中修改特定插件的操作链接。它允许开发者自定义插件激活、停用、删除等操作链接的显示。
关键要点
- 这是一个动态钩子,$plugin_file 是钩子名称的动态部分,表示插件文件相对于 plugins 目录的路径。
- 参数包括 $actions(操作链接数组)、$plugin_file(插件文件路径)、$plugin_data(插件数据数组)和 $context(插件上下文)。
- 可用于添加、移除或修改插件在 Network Admin 中的操作链接,例如基于插件状态或数据调整链接。
代码示例
$actions = apply_filters( "network_admin_plugin_action_links_{$plugin_file}", $actions, $plugin_file, $plugin_data, $context );注意事项
- 钩子从 WordPress 3.1.0 版本开始引入。
- 插件数据 $plugin_data 可通过 get_plugin_data() 获取,具体值参考 'plugin_row_meta' 过滤器。
- 上下文 $context 可能包括 'all'、'active'、'inactive' 等值,用于区分插件列表的不同视图。
原文内容
Filters the list of action links displayed for a specific plugin in the Network Admin Plugins list table.
Description
The dynamic portion of the hook name, $plugin_file, refers to the path to the plugin file, relative to the plugins directory.
Parameters
$actionsstring[]-
An array of plugin action links. By default this can include
'activate','deactivate', and'delete'. $plugin_filestring-
Path to the plugin file relative to the plugins directory.
$plugin_dataarray-
An array of plugin data. See get_plugin_data() and the ‘plugin_row_meta’ filter for the list of possible values.
$contextstring-
The plugin context. By default this can include
'all','active','inactive','recently_activated','upgrade','mustuse','dropins', and'search'.
Source
$actions = apply_filters( "network_admin_plugin_action_links_{$plugin_file}", $actions, $plugin_file, $plugin_data, $context );
Changelog
| Version | Description |
|---|---|
| 3.1.0 | Introduced. |