WP_REST_Sidebars_Controller::prepare_links()protectedWP 5.8.0

Prepares links for the sidebar.

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

Хуков нет.

Возвращает

Массив. Links for the given widget.

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

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

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

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

Код WP_REST_Sidebars_Controller::prepare_links() WP 6.4.3

protected function prepare_links( $sidebar ) {
	return array(
		'collection'               => array(
			'href' => rest_url( sprintf( '%s/%s', $this->namespace, $this->rest_base ) ),
		),
		'self'                     => array(
			'href' => rest_url( sprintf( '%s/%s/%s', $this->namespace, $this->rest_base, $sidebar['id'] ) ),
		),
		'https://api.w.org/widget' => array(
			'href'       => add_query_arg( 'sidebar', $sidebar['id'], rest_url( '/wp/v2/widgets' ) ),
			'embeddable' => true,
		),
	);
}