钩子文档

xmlrpc_prepare_post_type

💡 云策文档标注

概述

xmlrpc_prepare_post_type 是一个 WordPress 过滤器钩子,用于在 XML-RPC 响应中过滤指定文章类型的数据。它允许开发者修改文章类型数据,以便在 XML-RPC 对象中返回。

关键要点

  • 过滤器名称:xmlrpc_prepare_post_type
  • 参数:$_post_type(文章类型数据数组)和 $post_type(WP_Post_Type 对象)
  • 用途:在 XML-RPC 响应中自定义文章类型数据
  • 相关函数:wp_xmlrpc_server::_prepare_post_type() 用于准备 XML-RPC 对象中的文章数据
  • 版本历史:从 4.6.0 开始,$post_type 参数接受 WP_Post_Type 对象;最初在 3.4.0 引入

📄 原文内容

Filters XML-RPC-prepared date for the given post type.

Parameters

$_post_typearray
An array of post type data.
$post_typeWP_Post_Type
Post type object.

Source

return apply_filters( 'xmlrpc_prepare_post_type', $_post_type, $post_type );

Changelog

Version Description
4.6.0 Converted the $post_type parameter to accept a WP_Post_Type object.
3.4.0 Introduced.