WP_REST_Post_Types_Controller::prepare_links()protectedWP 6.1.0

Prepares links for the request.

Метод класса: WP_REST_Post_Types_Controller{}

Хуков нет.

Возвращает

Массив. Links for the given post type.

Использование

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->prepare_links( $post_type );
$post_type(WP_Post_Type) (обязательный)
The post type.

Список изменений

С версии 6.1.0 Введена.

Код WP_REST_Post_Types_Controller::prepare_links() WP 6.4.3

protected function prepare_links( $post_type ) {
	return array(
		'collection'              => array(
			'href' => rest_url( sprintf( '%s/%s', $this->namespace, $this->rest_base ) ),
		),
		'https://api.w.org/items' => array(
			'href' => rest_url( rest_get_route_for_post_type_items( $post_type->name ) ),
		),
	);
}