Changeset 48381
- Timestamp:
- 07/07/2020 03:29:22 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/rest-api/search/class-wp-rest-post-search-handler.php
r46586 r48381 149 149 $links = array(); 150 150 151 $item_route = $this->detect_rest_item_route( $post );151 $item_route = rest_get_route_for_post( $post ); 152 152 if ( ! empty( $item_route ) ) { 153 153 $links['self'] = array( … … 183 183 * 184 184 * @since 5.0.0 185 * @deprecated 5.5.0 Use rest_get_route_for_post() 186 * @see rest_get_route_for_post() 185 187 * 186 188 * @param WP_Post $post Post object. … … 188 190 */ 189 191 protected function detect_rest_item_route( $post ) { 190 $post_type = get_post_type_object( $post->post_type ); 191 if ( ! $post_type ) { 192 return ''; 193 } 192 _deprecated_function( __METHOD__, '5.5.0', 'rest_get_route_for_post()' ); 194 193 195 // It's currently impossible to detect the REST URL from a custom controller. 196 if ( ! empty( $post_type->rest_controller_class ) && 'WP_REST_Posts_Controller' !== $post_type->rest_controller_class ) { 197 return ''; 198 } 199 200 $namespace = 'wp/v2'; 201 $rest_base = ! empty( $post_type->rest_base ) ? $post_type->rest_base : $post_type->name; 202 203 return sprintf( '%s/%s/%d', $namespace, $rest_base, $post->ID ); 194 return rest_get_route_for_post( $post ); 204 195 } 205 196
Note: See TracChangeset
for help on using the changeset viewer.