after_plugin_row
云策文档标注
概述
after_plugin_row 是一个 WordPress 动作钩子,在插件列表表格的每一行之后触发,允许开发者在插件管理页面添加自定义内容或操作。
关键要点
- 钩子名称:after_plugin_row,用于插件列表的每一行后执行自定义代码。
- 参数:$plugin_file(插件文件路径)、$plugin_data(插件数据数组)、$status(插件状态,如 'active'、'inactive' 等)。
- 相关钩子:after_plugin_row_{file},针对特定插件文件,参数相同。
- 版本变化:WordPress 5.5.0 新增 $status 的 'auto-update-enabled' 和 'auto-update-disabled' 值。
注意事项
用户贡献的笔记提供了 $plugin_data 数组的示例结构,包含如 'Name'、'Version'、'Author' 等字段,但文档可能不完整,建议参考 get_plugin_data() 函数获取详细信息。
原文内容
Fires after each row in the Plugins list table.
Parameters
$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.
$statusstring-
Status filter currently applied to the plugin list.
Possible values are:'all','active','inactive','recently_activated','upgrade','mustuse','dropins','search','paused','auto-update-enabled','auto-update-disabled'.
Source
do_action( 'after_plugin_row', $plugin_file, $plugin_data, $status );
Skip to note 2 content
Geoffrey
It seems like the
$plugin_dataarray is composed like the following:array (size=27) 'id' => string '' (length=0) 'slug' => string '' (length=0) 'plugin' => string '' (length=0) 'new_version' => string '1.4.10' (length=6) 'url' => string '' (length=0) 'package' => string '' (length=0) 'icons' => array (size=2) '2x' => string '' (length=0) '1x' => string '' (length=0) 'banners' => array (size=1) '1x' => string '' (length=0) 'banners_rtl' => array (size=0) empty 'tested' => string '5.5.3' (length=5) 'requires_php' => boolean false 'compatibility' => object(stdClass)[1022] 'update-supported' => boolean true 'Name' => string '' (length=0) 'PluginURI' => string '' (length=0) 'Version' => string '1.4.9' (length=5) 'Description' => string '' (length=0) 'Author' => string '' (length=0) 'AuthorURI' => string '' (length=0) 'TextDomain' => string '' (length=0) 'DomainPath' => string '/languages' (length=10) 'Network' => boolean false 'RequiresWP' => string '' (length=0) 'RequiresPHP' => string '' (length=0) 'Title' => string '' (length=0) 'AuthorName' => string '' (length=0) 'update' => boolean trueJust FYI. Could be more complete in this documentation page.
You also have the
after_plugin_row_{file}hook that gives you something likeafter_plugin_row_akismet/akismet.phpfor instance, it takes the exact same parameters though.