WP_REST_Themes_Controller::prepare_links() WordPress Method

The prepare_links() method is used to prepare links for the WP_REST_Themes_Controller object. This method is called by the WP_REST_Themes_Controller::get_collection() method.

WP_REST_Themes_Controller::prepare_links( WP_Theme $theme ) #

Prepares links for the request.


Parameters

$theme

(WP_Theme)(Required)Theme data.


Top ↑

Return

(array) Links for the given block type.


Top ↑

Source

File: wp-includes/rest-api/endpoints/class-wp-rest-themes-controller.php

	protected function prepare_links( $theme ) {
		return array(
			'self'       => array(
				'href' => rest_url( sprintf( '%s/%s/%s', $this->namespace, $this->rest_base, $theme->get_stylesheet() ) ),
			),
			'collection' => array(
				'href' => rest_url( sprintf( '%s/%s', $this->namespace, $this->rest_base ) ),
			),
		);
	}


Top ↑

Changelog

Changelog
VersionDescription
5.7.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.