钩子文档

themes_api_result

💡 云策文档标注

概述

themes_api_result 是一个 WordPress 过滤器钩子,用于修改从 WordPress.org Themes API 返回的响应数据。它允许开发者在主题信息、功能列表或查询主题等操作中自定义 API 结果。

关键要点

  • 过滤器钩子名称为 themes_api_result,用于过滤 WordPress.org Themes API 的响应。
  • 参数包括 $res(响应数据,类型为 array、stdClass 或 WP_Error)、$action(请求的操作,如 'theme_information'、'feature_list' 或 'query_themes')和 $args(查询参数,类型为 stdClass)。
  • 源调用为 apply_filters('themes_api_result', $res, $action, $args),位于 themes_api() 函数中。
  • 相关函数 themes_api() 用于从 WordPress.org Themes API 检索主题安装页面。
  • 自 WordPress 2.8.0 版本引入。

📄 原文内容

Filters the returned WordPress.org Themes API response.

Parameters

$resarray|stdClass|WP_Error
WordPress.org Themes API response.
$actionstring
Requested action. Likely values are 'theme_information', 'feature_list', or 'query_themes'.
$argsstdClass
Arguments used to query for installer pages from the WordPress.org Themes API.

Source

return apply_filters( 'themes_api_result', $res, $action, $args );

Changelog

Version Description
2.8.0 Introduced.