rest_output_link_wp_head() WordPress Function

The rest_output_link_wp_head() function is used to output a REST API link tag in the document head. This function is called automatically by Wordpress when the REST API is enabled.

rest_output_link_wp_head() #

Outputs the REST API link tag into page header.


Description

Top ↑

See also


Top ↑

Source

File: wp-includes/rest-api.php

function rest_output_link_wp_head() {
	$api_root = get_rest_url();

	if ( empty( $api_root ) ) {
		return;
	}

	printf( '<link rel="https://api.w.org/" href="%s" />', esc_url( $api_root ) );

	$resource = rest_get_queried_resource_route();

	if ( $resource ) {
		printf( '<link rel="alternate" type="application/json" href="%s" />', esc_url( rest_url( $resource ) ) );
	}
}


Top ↑

Changelog

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

Show More