Filter hook 'xmlrpc_default_post_fields'

in WP Core File wp-includes/class-wp-xmlrpc-server.php at line 1995

View Source

xmlrpc_default_post_fields

Filter Hook
Description
Retrieves posts. 'post_status', 'number', 'offset', 'orderby', 's', and 'order'. Default empty array. }

Hook Information

File Location wp-includes/class-wp-xmlrpc-server.php View on GitHub
Hook Type Filter
Line Number 1995

Hook Parameters

Type Name Description
array $args { Method arguments. Note: arguments must be ordered as documented.

Usage Examples

Basic Usage
<?php
// Hook into xmlrpc_default_post_fields
add_filter('xmlrpc_default_post_fields', 'my_custom_filter', 10, 1);

function my_custom_filter($args) {
    // Your custom filtering logic here
    return $args;
}

Source Code Context

wp-includes/class-wp-xmlrpc-server.php:1995 - How this hook is used in WordPress core
<?php
1990  
1991  		if ( isset( $args[4] ) ) {
1992  			$fields = $args[4];
1993  		} else {
1994  			/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
1995  			$fields = apply_filters( 'xmlrpc_default_post_fields', array( 'post', 'terms', 'custom_fields' ), 'wp.getPosts' );
1996  		}
1997  
1998  		$user = $this->login( $username, $password );
1999  		if ( ! $user ) {
2000  			return $this->error;

PHP Documentation

<?php
/**
	 * Retrieves posts.
	 *
	 * @since 3.4.0
	 *
	 * @see wp_get_recent_posts()
	 * @see wp_getPost() for more on `$fields`
	 * @see get_posts() for more on `$filter` values
	 *
	 * @param array $args {
	 *     Method arguments. Note: arguments must be ordered as documented.
	 *
	 *     @type int    $0 Blog ID (unused).
	 *     @type string $1 Username.
	 *     @type string $2 Password.
	 *     @type array  $3 Optional. Modifies the query used to retrieve posts. Accepts 'post_type',
	 *                     'post_status', 'number', 'offset', 'orderby', 's', and 'order'.
	 *                     Default empty array.
	 *     @type array  $4 Optional. The subset of post type fields to return in the response array.
	 * }
	 * @return array|IXR_Error Array containing a collection of posts.
	 */
Quick Info
  • Hook Type: Filter
  • Parameters: 1
  • File: wp-includes/class-wp-xmlrpc-server.php
Related Hooks

Related hooks will be displayed here in future updates.