acf_field_oembed::wp_oembed_get()publicACF 5.0.0

Attempts to fetch the HTML for the provided URL using oEmbed.

Метод класса: acf_field_oembed{}

Хуков нет.

Возвращает

Строку|false. The embedded HTML on success, false on failure.

Использование

$acf_field_oembed = new acf_field_oembed();
$acf_field_oembed->wp_oembed_get( $url, $width, $height );
$url(строка)
The URL that should be embedded.
По умолчанию: ''
$width(int|строка)
Optional maxwidth value passed to the provider URL.
$height(int|строка)
Optional maxheight value passed to the provider URL.

Список изменений

С версии 5.0.0 Введена.

Код acf_field_oembed::wp_oembed_get() ACF 6.0.4

function wp_oembed_get( $url = '', $width = 0, $height = 0 ) {
	$embed = false;
	$res   = array(
		'width'  => $width,
		'height' => $height,
	);

	if ( function_exists( 'wp_oembed_get' ) ) {
		$embed = wp_oembed_get( $url, $res );
	}

	// try shortcode
	if ( ! $embed ) {
		global $wp_embed;
		$embed = $wp_embed->shortcode( $res, $url );
	}

	return $embed;
}