rest_parse_embed_param()WP 5.4.0

Parses the "_embed" parameter into the list of resources to embed.

No Hooks.

Return

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

Usage

rest_parse_embed_param( $embed );
$embed(string|array) (required)
Raw "_embed" parameter value.

Changelog

Since 5.4.0 Introduced.

rest_parse_embed_param() code WP 6.6.2

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;
}