W3cubDocs

/WordPress

WP_REST_URL_Details_Controller::prepare_metadata_for_output( string $metadata ): string

Prepares the metadata by: – stripping all HTML tags and tag entities.

Description

  • converting non-tag entities into characters.

Parameters

$metadatastringrequired
The metadata content to prepare.

Return

string The prepared metadata.

Source

private function prepare_metadata_for_output( $metadata ) {
	$metadata = html_entity_decode( $metadata, ENT_QUOTES, get_bloginfo( 'charset' ) );
	$metadata = wp_strip_all_tags( $metadata );
	return $metadata;
}

Changelog

Version Description
5.9.0 Introduced.

© 2003–2024 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_rest_url_details_controller/prepare_metadata_for_output