钩子文档

theme_action_links_{$stylesheet}

💡 云策文档标注

概述

此文档介绍 WordPress 多站点主题列表表格中用于过滤特定主题操作链接的动态 Hook。Hook 名称包含主题目录名作为动态部分,允许开发者自定义主题操作链接。

关键要点

  • Hook 名称:theme_action_links_{$stylesheet},其中 $stylesheet 是主题目录名,通常与模板名相同。
  • 参数:$actions(操作链接数组)、$theme(WP_Theme 对象)、$context(主题状态,如 'all'、'enabled' 或 'disabled')。
  • 用途:在 WP_MS_Themes_List_Table 和 WP_Themes_List_Table 类中用于处理主题列表的输出。
  • 版本:自 WordPress 3.1.0 引入。

📄 原文内容

Filters the action links of a specific theme in the Multisite themes list table.

Description

The dynamic portion of the hook name, $stylesheet, refers to the directory name of the theme, which in most cases is synonymous with the template name.

Parameters

$actionsstring[]
An array of action links.
$themeWP_Theme
The current WP_Theme object.
$contextstring
Status of the theme, one of 'all', 'enabled', or 'disabled'.

Source

$actions = apply_filters( "theme_action_links_{$stylesheet}", $actions, $theme, $context );

Changelog

Version Description
3.1.0 Introduced.