mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 01:27:36 +01:00
REST API: Include auto-discovery Link header when serving API requests.
The Link header allows clients to verify if a site has made the REST API available, as well as indicating how to access it. Props danielbachhuber. Fixes #35580. Built from https://develop.svn.wordpress.org/trunk@37903 git-svn-id: http://core.svn.wordpress.org/trunk@37844 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
a288544c41
commit
a475d0a161
@ -228,6 +228,11 @@ class WP_REST_Server {
|
||||
$this->send_header( 'Content-Type', $content_type . '; charset=' . get_option( 'blog_charset' ) );
|
||||
$this->send_header( 'X-Robots-Tag', 'noindex' );
|
||||
|
||||
$api_root = get_rest_url();
|
||||
if ( ! empty( $api_root ) ) {
|
||||
$this->send_header( 'Link', '<' . esc_url_raw( $api_root ) . '>; rel="https://api.w.org/"' );
|
||||
}
|
||||
|
||||
/*
|
||||
* Mitigate possible JSONP Flash attacks.
|
||||
*
|
||||
|
@ -4,7 +4,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '4.6-alpha-37902';
|
||||
$wp_version = '4.6-alpha-37903';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
Loading…
Reference in New Issue
Block a user