WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru
функция не описана

WP_Embed::get_embed_handler_html() public WP 5.5.0

Returns embed HTML for a given URL from embed handlers.

Attempts to convert a URL into embed HTML by checking the URL against the regex of the registered embed handlers.

Это метод класса: WP_Embed{}

Хуки из метода
Возвращает

Строку/false. The embed HTML on success, false otherwise.

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

$WP_Embed = new WP_Embed();
$WP_Embed->get_embed_handler_html( $attr, $url );
$attr(массив) (обязательный)

Shortcode attributes. Optional.

  • width(число)
    Width of the embed in pixels.

  • height(число)
    Height of the embed in pixels.
$url(строка) (обязательный)
The URL attempting to be embedded.

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

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

Код WP_Embed::get_embed_handler_html() WP 5.5.1

wp-includes/class-wp-embed.php
<?php
public function get_embed_handler_html( $attr, $url ) {
	$rawattr = $attr;
	$attr    = wp_parse_args( $attr, wp_embed_defaults( $url ) );

	ksort( $this->handlers );
	foreach ( $this->handlers as $priority => $handlers ) {
		foreach ( $handlers as $id => $handler ) {
			if ( preg_match( $handler['regex'], $url, $matches ) && is_callable( $handler['callback'] ) ) {
				$return = call_user_func( $handler['callback'], $matches, $attr, $url, $rawattr );
				if ( false !== $return ) {
					/**
					 * Filters the returned embed HTML.
					 *
					 * @since 2.9.0
					 *
					 * @see WP_Embed::shortcode()
					 *
					 * @param string|false $return The HTML result of the shortcode, or false on failure.
					 * @param string       $url    The embed URL.
					 * @param array        $attr   An array of shortcode attributes.
					 */
					return apply_filters( 'embed_handler_html', $return, $url, $attr );
				}
			}
		}
	}

	return false;
}