wp_xmlrpc_server::wp_getPage( array $args ): array|IXR_Error

In this article

Retrieves a page.

Parameters

$argsarrayrequired
Method arguments. Note: arguments must be ordered as documented.
  • 0 int
    Blog ID (unused).
  • 1 int
    Page ID.
  • 2 string
    Username.
  • 3 string
    Password.

Return

array|IXR_Error

Source

 *
 * @param array $args {
 *     Method arguments. Note: arguments must be ordered as documented.
 *
 *     @type int    $0 Blog ID (unused).
 *     @type int    $1 Page ID.
 *     @type string $2 Username.
 *     @type string $3 Password.
 * }
 * @return array|IXR_Error
 */
public function wp_getPage( $args ) {
	$this->escape( $args );

	$page_id  = (int) $args[1];
	$username = $args[2];
	$password = $args[3];

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

	$page = get_post( $page_id );
	if ( ! $page ) {
		return new IXR_Error( 404, __( 'Invalid post ID.' ) );
	}

	if ( ! current_user_can( 'edit_page', $page_id ) ) {
		return new IXR_Error( 401, __( 'Sorry, you are not allowed to edit this page.' ) );
	}

Changelog

VersionDescription
2.2.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.