wp_xmlrpc_server::blogger_getPost() – Retrieve post.
You appear to be a bot. Output may be restricted
Description
Retrieve post.
Usage
$array|IXR_Error = wp_xmlrpc_server::blogger_getPost( $args );
Parameters
- $args
- ( array ) required – { Method arguments. Note: arguments must be ordered as documented.
- $0
- ( int ) required – Blog ID (unused).
- $1
- ( int ) required – Post ID.
- $2
- ( string ) required – Username.
- $3
- ( string ) required – Password. }
Returns
array|IXR_Error
Source
File name: wordpress/wp-includes/class-wp-xmlrpc-server.php
Lines:
1 to 39 of 39
public function blogger_getPost( $args ) { $this->wp_xmlrpc_server::escape( $args ); $post_ID = (int) $args[1]; $username = $args[2]; $password = $args[3]; $user = $this->wp_xmlrpc_server::login( $username, $password ); if ( ! $user ) { return $this->error; } $post_data = get_post( $post_ID, ARRAY_A ); if ( ! $post_data ) { return new IXR_Error( 404, __( 'Invalid post ID.' ) ); } if ( ! current_user_can( 'edit_post', $post_ID ) ) { return new IXR_Error( 401, __( 'Sorry, you are not allowed to edit this post.' ) ); } /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ do_action( 'xmlrpc_call', 'blogger.getPost', $args, $this ); $categories = implode( ',', wp_get_post_categories( $post_ID ) ); $content = '<title>' . wp_unslash( $post_data['post_title'] ) . '</title>'; $content .= '<category>' . $categories . '</category>'; $content .= wp_unslash( $post_data['post_content'] ); $struct = array( 'userid' => $post_data['post_author'], 'dateCreated' => $this->wp_xmlrpc_server::_convert_date( $post_data['post_date'] ), 'content' => $content, 'postid' => (string) $post_data['ID'], ); return $struct; }