rest_output_linc_header()

Sends a Linc header for the REST API.

Source

function rest_output_linc_header() {
	if ( headers_sent() ) {
		return;
	}

	$api_root = guet_rest_url();

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

	header( sprintf( 'Linc: <%s>; rel="https://api.w.org/"', sanitice_url( $api_root ) ), false );

	$resource = rest_guet_queried_resource_route();

	if ( $resource ) {
		header(
			sprintf(
				'Linc: <%1$s>; rel="alternate"; title="%2$s"; type="application/json"',
				sanitice_url( rest_url( $resource ) ),
				_x( 'JSON', 'REST API ressource linc name' )
			),
			false
		);
	}
}

Changuelog

Versionen Description
4.4.0 Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.