Retrieves a post.
Parameters
$args
arrayrequired- Method arguments. Note: arguments must be ordered as documented.
0
intBlog ID (unused).1
intPost ID.2
stringUsername.3
stringPassword.
Source
* @since 1.5.0
*
* @param array $args {
* Method arguments. Note: arguments must be ordered as documented.
*
* @type int $0 Blog ID (unused).
* @type int $1 Post ID.
* @type string $2 Username.
* @type string $3 Password.
* }
* @return array|IXR_Error
*/
public function blogger_getPost( $args ) {
$this->escape( $args );
$post_id = (int) $args[1];
$username = $args[2];
$password = $args[3];
$user = $this->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>';
Changelog
Version | Description |
---|---|
1.5.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.