diff --git a/wp-includes/class-wp-xmlrpc-server.php b/wp-includes/class-wp-xmlrpc-server.php index 6eadaf8bbb..1cb0d0fa25 100644 --- a/wp-includes/class-wp-xmlrpc-server.php +++ b/wp-includes/class-wp-xmlrpc-server.php @@ -1582,16 +1582,19 @@ class wp_xmlrpc_server extends IXR_Server { do_action( 'xmlrpc_call', 'wp.deletePost' ); $post = get_post( $post_id, ARRAY_A ); - if ( empty( $post['ID'] ) ) + 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.' ) ); + if ( ! current_user_can( 'delete_post', $post_id ) ) { + return new IXR_Error( 401, __( 'Sorry, you do not have the right to delete this post.' ) ); + } $result = wp_delete_post( $post_id ); - if ( ! $result ) + if ( ! $result ) { return new IXR_Error( 500, __( 'The post cannot be deleted.' ) ); + } return true; } @@ -4685,18 +4688,21 @@ class wp_xmlrpc_server extends IXR_Server { /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ do_action( 'xmlrpc_call', 'blogger.deletePost' ); - $actual_post = get_post($post_ID,ARRAY_A); + $actual_post = get_post( $post_ID, ARRAY_A ); - if ( !$actual_post || $actual_post['post_type'] != 'post' ) - return new IXR_Error(404, __('Sorry, no such post.')); + if ( ! $actual_post || $actual_post['post_type'] != 'post' ) { + return new IXR_Error( 404, __( 'Sorry, no such post.' ) ); + } - if ( !current_user_can('delete_post', $post_ID) ) - return new IXR_Error(401, __('Sorry, you do not have the right to delete this post.')); + if ( ! current_user_can( 'delete_post', $post_ID ) ) { + return new IXR_Error( 401, __( 'Sorry, you do not have the right to delete this post.' ) ); + } - $result = wp_delete_post($post_ID); + $result = wp_delete_post( $post_ID ); - if ( !$result ) - return new IXR_Error(500, __('For some strange yet very annoying reason, this post could not be deleted.')); + if ( ! $result ) { + return new IXR_Error( 500, __( 'The post cannot be deleted.' ) ); + } /** * Fires after a post has been successfully deleted via the XML-RPC Blogger API. diff --git a/wp-includes/version.php b/wp-includes/version.php index 0b7fdc73be..6fa9300d3c 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.4-alpha-34797'; +$wp_version = '4.4-alpha-34798'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.