do_action( 'xmlrpc_call', 'wp.deletePost',
$args,
$this );
$post =
get_post( $post_id, ARRAY_A
);
if ( empty( $post['ID'
] ) ) { return new IXR_Error( 404,
__( 'Invalid post ID.'
) );
} if ( !
current_user_can( 'delete_post',
$post_id ) ) { return new IXR_Error( 401,
__( 'Sorry, you are not allowed to delete this post.'
) );
} $result =
wp_delete_post( $post_id );
if ( !
$result ) { return new IXR_Error( 500,
__( 'Sorry, the post could not be deleted.'
) );
} return true;
} /**
* Retrieves a post.
*
* @since 3.4.0
*
* The optional $fields parameter specifies what fields will be included
* in the response array. This should be a list of field names. 'post_id' will
* always be included in the response regardless of the value of $fields.
*
* Instead of, or in addition to, individual field names, conceptual group
* names can be used to specify multiple fields. The available conceptual
* groups are 'post' (all basic fields), 'taxonomies', 'custom_fields',
* and 'enclosure'.
*
* @see get_post()
*
* @param array $args {
* Method arguments. Note: arguments must be ordered as documented.
*
* @type int $0 Blog ID (unused).
* @type string $1 Username.
* @type string $2 Password.
* @type int $3 Post ID.
* @type array $4 Optional. The subset of post type fields to return.
* }
* @return array|IXR_Error Array contains (based on $fields parameter):
* - 'post_id'
* - 'post_title'
* - 'post_date'
* - 'post_date_gmt'
* - 'post_modified'
* - 'post_modified_gmt'
* - 'post_status'
* - 'post_type'
* - 'post_name'
* - 'post_author'
* - 'post_password'
* - 'post_excerpt'
* - 'post_content'
* - 'link'
* - 'comment_status'
* - 'ping_status'
* - 'sticky'
* - 'custom_fields'
* - 'terms'
* - 'categories'
* - 'tags'
* - 'enclosure'
*/