Changeset 54970
- Timestamp:
- 12/14/2022 01:50:06 PM (21 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-revisions-controller.php
r54121 r54970 135 135 * @since 4.7.2 136 136 * 137 * @param int $parent Supplied ID.137 * @param int $parent_post Supplied ID. 138 138 * @return WP_Post|WP_Error Post object if ID is valid, WP_Error otherwise. 139 139 */ 140 protected function get_parent( $parent ) {140 protected function get_parent( $parent_post ) { 141 141 $error = new WP_Error( 142 142 'rest_post_invalid_parent', … … 144 144 array( 'status' => 404 ) 145 145 ); 146 if ( (int) $parent <= 0 ) { 146 147 if ( (int) $parent_post <= 0 ) { 147 148 return $error; 148 149 } 149 150 150 $parent = get_post( (int) $parent ); 151 if ( empty( $parent ) || empty( $parent->ID ) || $this->parent_post_type !== $parent->post_type ) { 151 $parent_post = get_post( (int) $parent_post ); 152 153 if ( empty( $parent_post ) || empty( $parent_post->ID ) 154 || $this->parent_post_type !== $parent_post->post_type 155 ) { 152 156 return $error; 153 157 } 154 158 155 return $parent ;159 return $parent_post; 156 160 } 157 161
Note: See TracChangeset
for help on using the changeset viewer.