Changeset 47122 for trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-post-types-controller.php
- Timestamp:
- 01/29/2020 12:43:23 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-post-types-controller.php
r47034 r47122 90 90 } 91 91 92 return new WP_Error( 'rest_cannot_view', __( 'Sorry, you are not allowed to edit posts in this post type.' ), array( 'status' => rest_authorization_required_code() ) ); 92 return new WP_Error( 93 'rest_cannot_view', 94 __( 'Sorry, you are not allowed to edit posts in this post type.' ), 95 array( 'status' => rest_authorization_required_code() ) 96 ); 93 97 } 94 98 … … 132 136 133 137 if ( empty( $obj ) ) { 134 return new WP_Error( 'rest_type_invalid', __( 'Invalid post type.' ), array( 'status' => 404 ) ); 138 return new WP_Error( 139 'rest_type_invalid', 140 __( 'Invalid post type.' ), 141 array( 'status' => 404 ) 142 ); 135 143 } 136 144 137 145 if ( empty( $obj->show_in_rest ) ) { 138 return new WP_Error( 'rest_cannot_read_type', __( 'Cannot view post type.' ), array( 'status' => rest_authorization_required_code() ) ); 146 return new WP_Error( 147 'rest_cannot_read_type', 148 __( 'Cannot view post type.' ), 149 array( 'status' => rest_authorization_required_code() ) 150 ); 139 151 } 140 152 141 153 if ( 'edit' === $request['context'] && ! current_user_can( $obj->cap->edit_posts ) ) { 142 return new WP_Error( 'rest_forbidden_context', __( 'Sorry, you are not allowed to edit posts in this post type.' ), array( 'status' => rest_authorization_required_code() ) ); 154 return new WP_Error( 155 'rest_forbidden_context', 156 __( 'Sorry, you are not allowed to edit posts in this post type.' ), 157 array( 'status' => rest_authorization_required_code() ) 158 ); 143 159 } 144 160 … … 322 338 323 339 $this->schema = $schema; 340 324 341 return $this->add_additional_fields_schema( $this->schema ); 325 342 }
Note: See TracChangeset
for help on using the changeset viewer.