W3cubDocs

/WordPress

rest_parse_embed_param( string|array $embed ): true|string[]

Parses the “_embed” parameter into the list of resources to embed.

Parameters

$embedstring|arrayrequired
Raw "_embed" parameter value.

Return

true|string[] Either true to embed all embeds, or a list of relations to embed.

Source

function rest_parse_embed_param( $embed ) {
	if ( ! $embed || 'true' === $embed || '1' === $embed ) {
		return true;
	}

	$rels = wp_parse_list( $embed );

	if ( ! $rels ) {
		return true;
	}

	return $rels;
}

Changelog

Version Description
5.4.0 Introduced.

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