Make WordPress Core

Changes between Version 1 and Version 2 of Ticket #51956, comment 18


Ignore:
Timestamp:
12/08/2020 03:57:12 PM (6 years ago)
Author:
NicolasKulka

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #51956, comment 18

    v1 v2  
    11ye, function 'rest_output_link_wp_head' return two links
     2
     3
     4{{{
     5/**
     6 * Outputs the REST API link tag into page header.
     7 *
     8 * @since 4.4.0
     9 *
     10 * @see get_rest_url()
     11 */
     12function rest_output_link_wp_head() {
     13        $api_root = get_rest_url();
     14
     15        if ( empty( $api_root ) ) {
     16                return;
     17        }
     18
     19        printf( '<link rel="https://api.w.org/" href="%s" />', esc_url( $api_root ) );
     20
     21        $resource = rest_get_queried_resource_route();
     22
     23        if ( $resource ) {
     24                printf( '<link rel="alternate" type="application/json" href="%s" />', esc_url( rest_url( $resource ) ) );
     25        }
     26}
     27}}}
     28
    229
    330This function 'rest_get_queried_resource_route' add a second link, add WP 5.5