WP_REST_URL_Details_Controller::get_description() – Parses the meta description from the provided HTML.

You appear to be a bot. Output may be restricted

Description

Parses the meta description from the provided HTML.

Usage

$string = WP_REST_URL_Details_Controller::get_description( $meta_elements );

Parameters

$meta_elements
( array ) required – { A multi-dimensional indexed array on success, else empty array.
$0
( string[] ) required – Meta elements with a content attribute.
$1
( string[] ) required – Content attribute's opening quotation mark.
$2
( string[] ) required – Content attribute's value for each meta element. }

Returns

string The meta description contents on success. Empty string if not found.

Source

File name: wordpress/wp-includes/rest-api/endpoints/class-wp-rest-url-details-controller.php
Lines:

1 to 19 of 19
  private function get_description( $meta_elements ) {
    // Bail out if there are no meta elements.
    if ( empty( $meta_elements[0] ) ) {
      return '';
    }

    $description = $this->get_metadata_from_meta_element(
      $meta_elements,
      'name',
      '(?:description|og:description)'
    );

    // Bail out if description not found.
    if ( '' === $description ) {
      return '';
    }

    return $this->prepare_metadata_for_output( $description );
  }
 

 View on GitHub View on Trac