theme_action_links
云策文档标注
概述
theme_action_links 过滤器用于修改多站点主题列表表中每个主题显示的操作链接。这些链接根据主题状态和列表表类型(网络主题列表或站点主题列表)动态生成。
关键要点
- 过滤器应用于多站点主题列表表,包括 themes.php(网络主题列表)和 site-themes.php(站点主题列表)。
- 默认操作链接因列表表类型而异:网络主题列表包括“网络启用”、“网络禁用”和“删除”;站点主题列表包括“启用”和“禁用”。
- 参数包括 $actions(操作链接数组)、$theme(当前 WP_Theme 对象)和 $context(主题状态,如 'all'、'enabled' 或 'disabled')。
- 通过 apply_filters('theme_action_links', $actions, $theme, $context) 调用,允许开发者自定义链接。
注意事项
- 此过滤器自 WordPress 2.8.0 版本引入,用于控制主题管理界面的操作链接显示。
- 相关函数包括 WP_MS_Themes_List_Table::column_name() 和 WP_Themes_List_Table::display_rows(),用于处理列表表输出。
原文内容
Filters the action links displayed for each theme in the Multisite themes list table.
Description
The action links displayed are determined by the theme’s status, and which Multisite themes list table is being displayed – the Network themes list table (themes.php), which displays all installed themes, or the Site themes list table (site-themes.php), which displays the non-network enabled themes when editing a site in the Network admin.
The default action links for the Network themes list table include ‘Network Enable’, ‘Network Disable’, and ‘Delete’.
The default action links for the Site themes list table include ‘Enable’, and ‘Disable’.
Parameters
Source
$actions = apply_filters( 'theme_action_links', array_filter( $actions ), $theme, $context );
Changelog
| Version | Description |
|---|---|
| 2.8.0 | Introduced. |