钩子文档

install_theme_overwrite_actions

💡 云策文档标注

概述

install_theme_overwrite_actions 是一个 WordPress 过滤器钩子,用于在允许覆盖安装时,过滤单个主题安装失败后显示的操作链接列表。它允许开发者自定义这些链接,例如添加或移除选项。

关键要点

  • 过滤器钩子:install_theme_overwrite_actions,用于修改主题安装失败后的操作链接。
  • 参数:接受三个参数:$install_actions(操作链接数组)、$api(WordPress.org API 主题数据对象)和 $new_theme_data(上传主题数据数组)。
  • 用途:主要用于主题安装覆盖场景,例如在 Theme_Installer_Skin::do_overwrite() 中调用。
  • 版本:从 WordPress 5.5.0 版本开始引入。

📄 原文内容

Filters the list of action links available following a single theme installation failure when overwriting is allowed.

Parameters

$install_actionsstring[]
Array of theme action links.
$apiobject
Object containing WordPress.org API theme data.
$new_theme_dataarray
Array with uploaded theme data.

Source

$install_actions = apply_filters( 'install_theme_overwrite_actions', $install_actions, $this->api, $new_theme_data );

Changelog

Version Description
5.5.0 Introduced.