Make WordPress Core


Ignore:
Timestamp:
06/02/2024 10:00:26 PM (2 years ago)
Author:
audrasjb
Message:

Embeds: Add titles to alternate resource links for oEmbed and REST API.

This changeset makes the following changes:

Props edent, kadamwhite, TimothyBlynJacobs, joedolson, swissspidy, sabernhardt.
Fixes #59006.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/rest-api.php

    r58267 r58286  
    10081008
    10091009        if ( $resource ) {
    1010                 printf( '<link rel="alternate" type="application/json" href="%s" />', esc_url( rest_url( $resource ) ) );
     1010                printf(
     1011                        '<link rel="alternate" title="%1$s" type="application/json" href="%2$s" />',
     1012                        _x( 'JSON', 'REST API resource link name' ),
     1013                        esc_url( rest_url( $resource ) )
     1014                );
    10111015        }
    10121016}
    … …  
    10331037
    10341038        if ( $resource ) {
    1035                 header( sprintf( 'Link: <%s>; rel="alternate"; type="application/json"', sanitize_url( rest_url( $resource ) ) ), false );
     1039                header(
     1040                        sprintf(
     1041                                'Link: <%1$s>; rel="alternate"; title="%2$s"; type="application/json"',
     1042                                sanitize_url( rest_url( $resource ) ),
     1043                                _x( 'JSON', 'REST API resource link name' )
     1044                        ),
     1045                        false
     1046                );
    10361047        }
    10371048}
Note: See TracChangeset for help on using the changeset viewer.