Warning: This method has been deprecated. Use rest_get_route_for_post() instead.

WP_REST_Post_Search_Handler::detect_rest_item_route() WordPress Method

The WP_REST_Post_Search_Handler::detect_rest_item_route() method is used to search for a REST route for a given post. This is useful for finding the REST route for a post when the post_type or post_status is not known. The method takes a WP_Post object as its only parameter and returns a string containing the REST route for the post if one is found, or an empty string if no route is found.

WP_REST_Post_Search_Handler::detect_rest_item_route( WP_Post $post ) #

Attempts to detect the route to access a single item.


Description

Top ↑

See also


Top ↑

Parameters

$post

(WP_Post)(Required)Post object.


Top ↑

Return

(string) REST route relative to the REST base URI, or empty string if unknown.


Top ↑

Source

File: wp-includes/rest-api/search/class-wp-rest-post-search-handler.php

	protected function detect_rest_item_route( $post ) {
		_deprecated_function( __METHOD__, '5.5.0', 'rest_get_route_for_post()' );

		return rest_get_route_for_post( $post );
	}


Top ↑

Changelog

Changelog
VersionDescription
5.5.0Use rest_get_route_for_post()
5.0.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.