WordPress at a glance
function is not described

WP_REST_Post_Search_Handler::detect_rest_item_route() protected WP 5.0.0

Deprecated in from version 5.5.0. It is no longer supported and can be removed in future releases. Use rest_get_route_for_post() instead.

Attempts to detect the route to access a single item.

{} It's a method of the class: WP_REST_Post_Search_Handler{}

No Hooks.

Return

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

Usage

// protected - for code of main (parent) or child class
$result = $this->detect_rest_item_route( $post );
$post(WP_Post) (required)
Post object.

Notes

  • See: rest_get_route_for_post()

Changelog

Since 5.0.0 Introduced.
Deprecated Since 5.5.0 Use rest_get_route_for_post()

Code of WP_REST_Post_Search_Handler::detect_rest_item_route() WP 5.5.1

<?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 );
}