WordPress at a glance
function is not described

wp_xmlrpc_server::mt_getRecentPostTitles() public WP 1.5.0

Retrieve the post titles of recent posts.

{} It's a method of the class: wp_xmlrpc_server{}

Hooks from the method
Return

Array/IXR_Error.

Usage

$wp_xmlrpc_server = new wp_xmlrpc_server();
$wp_xmlrpc_server->mt_getRecentPostTitles( $args );
$args(array) (required)

Method arguments. Note: arguments must be ordered as documented.

  • blog_id(int)
    (unused)

  • username(string)

  • password(string)

  • numberposts(int)

Changelog

Since 1.5.0 Introduced.

Code of wp_xmlrpc_server::mt_getRecentPostTitles() WP 5.5.1

<?php
public function mt_getRecentPostTitles( $args ) {
	$this->escape( $args );

	$username = $args[1];
	$password = $args[2];
	if ( isset( $args[3] ) ) {
		$query = array( 'numberposts' => absint( $args[3] ) );
	} else {
		$query = array();
	}

	$user = $this->login( $username, $password );
	if ( ! $user ) {
		return $this->error;
	}

	/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
	do_action( 'xmlrpc_call', 'mt.getRecentPostTitles' );

	$posts_list = wp_get_recent_posts( $query );

	if ( ! $posts_list ) {
		$this->error = new IXR_Error( 500, __( 'Either there are no posts, or something went wrong.' ) );
		return $this->error;
	}

	$recent_posts = array();

	foreach ( $posts_list as $entry ) {
		if ( ! current_user_can( 'edit_post', $entry['ID'] ) ) {
			continue;
		}

		$post_date     = $this->_convert_date( $entry['post_date'] );
		$post_date_gmt = $this->_convert_date_gmt( $entry['post_date_gmt'], $entry['post_date'] );

		$recent_posts[] = array(
			'dateCreated'      => $post_date,
			'userid'           => $entry['post_author'],
			'postid'           => (string) $entry['ID'],
			'title'            => $entry['post_title'],
			'post_status'      => $entry['post_status'],
			'date_created_gmt' => $post_date_gmt,
		);
	}

	return $recent_posts;
}