wp_xmlrpc_server::wp_getPage( array $args )
Retrieves a page.
Parameters
- $args
-
(Required) Method arguments. Note: arguments must be ordered as documented.<br>
- (int) Blog ID (unused).<br>
- '1'
(int) Page ID.<br> - '2'
(string) Username.<br> - '3'
(string) Password.<br>
Return
(array|IXR_Error)
Source
File: wp-includes/class-wp-xmlrpc-server.php
public function wp_getPage( $args ) {
$this->escape( $args );
$page_id = (int) $args[1];
$username = $args[2];
$password = $args[3];
if ( !$user = $this->login($username, $password) ) {
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.' ) );
/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
do_action( 'xmlrpc_call', 'wp.getPage' );
// If we found the page then format the data.
if ( $page->ID && ($page->post_type == 'page') ) {
return $this->_prepare_page( $page );
}
// If the page doesn't exist indicate that.
else {
return new IXR_Error( 404, __( 'Sorry, no such page.' ) );
}
}
Changelog
Version | Description |
---|---|
2.2.0 | Introduced. |