Make WordPress Core


Ignore:
Timestamp:
11/02/2021 12:46:01 PM (3 years ago)
Author:
hellofromTonya
Message:

REST API: Add URL Details endpoint.

Adds a new REST API endpoint (/wp-block-editor/v1/url-details) for retrieving information from an external URL.

Information retrieved:

  • Title: content of the <title> element
  • Icon: favicon image link
  • Description: content of the description or og:description meta element
  • Image: OG image link

This endpoint is used by the block editor for link previews.

Props get_dave, aduth, andraganescu, beaulebens, hellofromTonya, kevin940726, mamaduka, marekhrabe, mnelson4, noisysocks, obenland, ocean90, retrofox, shaunandrews, spacedmonkey, swissspidy, timothyblynjacobs, xknown, youknowriad.
Fixes #54358.

File:
1 edited

Legend:

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

    r51964 r51973  
    337337    $site_health = WP_Site_Health::get_instance();
    338338    $controller  = new WP_REST_Site_Health_Controller( $site_health );
     339    $controller->register_routes();
     340
     341    // URL Details.
     342    $controller = new WP_REST_URL_Details_Controller();
    339343    $controller->register_routes();
    340344}
Note: See TracChangeset for help on using the changeset viewer.