- Timestamp:
- 11/03/2016 08:04:59 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php
r39106 r39126 84 84 'args' => array( 85 85 'force' => array( 86 'type' => 'boolean', 86 87 'default' => false, 87 88 'description' => __( 'Whether to bypass trash and force deletion.' ), … … 739 740 $request->set_param( 'context', 'edit' ); 740 741 741 $response = $this->prepare_item_for_response( $comment, $request );742 743 742 if ( $force ) { 743 $previous = $this->prepare_item_for_response( $comment, $request ); 744 744 $result = wp_delete_comment( $comment->comment_ID, true ); 745 $response = new WP_REST_Response(); 746 $response->set_data( array( 'deleted' => true, 'previous' => $previous->get_data() ) ); 745 747 } else { 746 748 // If this type doesn't support trashing, error out. 747 749 if ( ! $supports_trash ) { 748 return new WP_Error( 'rest_trash_not_supported', __( 'The comment does not support trashing. ' ), array( 'status' => 501 ) );750 return new WP_Error( 'rest_trash_not_supported', __( 'The comment does not support trashing. Set force=true to delete.' ), array( 'status' => 501 ) ); 749 751 } 750 752 … … 754 756 755 757 $result = wp_trash_comment( $comment->comment_ID ); 758 $comment = get_comment( $comment->comment_ID ); 759 $response = $this->prepare_item_for_response( $comment, $request ); 756 760 } 757 761
Note: See TracChangeset
for help on using the changeset viewer.