- Timestamp:
- 11/03/2016 08:04:59 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php
r39108 r39126 102 102 'args' => array( 103 103 'force' => array( 104 'type' => 'boolean', 104 105 'default' => false, 105 106 'description' => __( 'Whether to bypass trash and force deletion.' ), … … 758 759 $request->set_param( 'context', 'edit' ); 759 760 760 $response = $this->prepare_item_for_response( $post, $request );761 761 762 762 // If we're forcing, then delete permanently. 763 763 if ( $force ) { 764 $previous = $this->prepare_item_for_response( $post, $request ); 764 765 $result = wp_delete_post( $id, true ); 766 $response = new WP_REST_Response(); 767 $response->set_data( array( 'deleted' => true, 'previous' => $previous->get_data() ) ); 765 768 } else { 766 769 // If we don't support trashing for this type, error out. 767 770 if ( ! $supports_trash ) { 768 return new WP_Error( 'rest_trash_not_supported', __( 'The post does not support trashing. ' ), array( 'status' => 501 ) );771 return new WP_Error( 'rest_trash_not_supported', __( 'The post does not support trashing. Set force=true to delete.' ), array( 'status' => 501 ) ); 769 772 } 770 773 … … 777 780 // the trash is disabled.) 778 781 $result = wp_trash_post( $id ); 782 $post = $this->get_post( $id ); 783 $response = $this->prepare_item_for_response( $post, $request ); 779 784 } 780 785
Note: See TracChangeset
for help on using the changeset viewer.