钩子文档

xmlrpc_default_post_fields

💡 云策文档标注

概述

xmlrpc_default_post_fields 是一个 WordPress 过滤器,用于修改指定 XML-RPC 方法中默认的帖子查询字段。它允许开发者自定义在 XML-RPC 请求中返回的帖子数据字段。

关键要点

  • 这是一个过滤器钩子,名称为 xmlrpc_default_post_fields。
  • 默认返回的字段包括 'post'、'terms' 和 'custom_fields'。
  • 主要用于 wp.getPost 和 wp.getPosts 等 XML-RPC 方法。
  • 从 WordPress 3.4.0 版本开始引入。

代码示例

$fields = apply_filters( 'xmlrpc_default_post_fields', array( 'post', 'terms', 'custom_fields' ), 'wp.getPost' );

📄 原文内容

Filters the default post query fields used by the given XML-RPC method.

Parameters

$fieldsarray
An array of post fields to retrieve. By default, contains 'post', 'terms', and 'custom_fields'.
$methodstring
Method name.

Source

$fields = apply_filters( 'xmlrpc_default_post_fields', array( 'post', 'terms', 'custom_fields' ), 'wp.getPost' );

Changelog

Version Description
3.4.0 Introduced.