钩子文档

install_plugins_{$tab}

💡 云策文档标注

概述

install_plugins_{$tab} 是一个 WordPress 动态 Hook,在安装插件屏幕的每个标签页的插件列表表格后触发。它允许开发者针对特定标签页执行自定义操作。

关键要点

  • 这是一个动态 Hook,$tab 参数用于指定目标标签页,如 install_plugins_popular 或 install_plugins_search。
  • Hook 在插件列表表格后触发,参数 $paged 表示当前页码。
  • 可用于扩展或修改安装插件界面的功能,例如添加自定义内容或处理数据。

代码示例

do_action( "install_plugins_{$tab}", $paged );

注意事项

  • 确保 $tab 参数正确匹配标签页名称,以避免 Hook 不触发。
  • 此 Hook 自 WordPress 2.7.0 版本引入,使用时需考虑版本兼容性。

📄 原文内容

Fires after the plugins list table in each tab of the Install Plugins screen.

Description

The dynamic portion of the hook name, $tab, allows for targeting individual tabs.

Possible hook names include:

  • install_plugins_beta
  • install_plugins_favorites
  • install_plugins_featured
  • install_plugins_plugin-information
  • install_plugins_popular
  • install_plugins_recommended
  • install_plugins_search
  • install_plugins_upload

Parameters

$pagedint
The current page number of the plugins list table.

Source

do_action( "install_plugins_{$tab}", $paged );

Changelog

Version Description
2.7.0 Introduced.