- Timestamp:
- 11/18/2016 06:11:49 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php
r39278 r39289 992 992 993 993 // Parent. 994 if ( ! empty( $schema['properties']['parent'] ) && ! empty( $request['parent'] ) ) { 995 $parent = get_post( (int) $request['parent'] ); 996 997 if ( empty( $parent ) ) { 998 return new WP_Error( 'rest_post_invalid_id', __( 'Invalid post parent ID.' ), array( 'status' => 400 ) ); 999 } 1000 1001 $prepared_post->post_parent = (int) $parent->ID; 994 if ( ! empty( $schema['properties']['parent'] ) && isset( $request['parent'] ) ) { 995 if ( 0 === (int) $request['parent'] ) { 996 $prepared_post->post_parent = 0; 997 } else { 998 $parent = get_post( (int) $request['parent'] ); 999 if ( empty( $parent ) ) { 1000 return new WP_Error( 'rest_post_invalid_id', __( 'Invalid post parent ID.' ), array( 'status' => 400 ) ); 1001 } 1002 $prepared_post->post_parent = (int) $parent->ID; 1003 } 1002 1004 } 1003 1005
Note: See TracChangeset
for help on using the changeset viewer.