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

get_oembed_response_data_for_url() WP 5.0.0

Retrieves the oEmbed response data for a given URL.

Хуки из функции
Возвращает

Объект/false. oEmbed response data if the URL does belong to the current site. False otherwise.

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

get_oembed_response_data_for_url( $url, $args );
$url(строка) (обязательный)
The URL that should be inspected for discovery <link> tags.
$args(массив) (обязательный)
oEmbed remote get arguments.

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

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

Код get oembed response data for url: wp-includes/embed.php WP 5.2.4

<?php
function get_oembed_response_data_for_url( $url, $args ) {
	$switched_blog = false;

	if ( is_multisite() ) {
		$url_parts = wp_parse_args(
			wp_parse_url( $url ),
			array(
				'host' => '',
				'path' => '/',
			)
		);

		$qv = array(
			'domain'                 => $url_parts['host'],
			'path'                   => '/',
			'update_site_meta_cache' => false,
		);

		// In case of subdirectory configs, set the path.
		if ( ! is_subdomain_install() ) {
			$path = explode( '/', ltrim( $url_parts['path'], '/' ) );
			$path = reset( $path );

			if ( $path ) {
				$qv['path'] = get_network()->path . $path . '/';
			}
		}

		$sites = get_sites( $qv );
		$site  = reset( $sites );

		if ( $site && (int) $site->blog_id !== get_current_blog_id() ) {
			switch_to_blog( $site->blog_id );
			$switched_blog = true;
		}
	}

	$post_id = url_to_postid( $url );

	/** This filter is documented in wp-includes/class-wp-oembed-controller.php */
	$post_id = apply_filters( 'oembed_request_post_id', $post_id, $url );

	if ( ! $post_id ) {
		if ( $switched_blog ) {
			restore_current_blog();
		}

		return false;
	}

	$width = isset( $args['width'] ) ? $args['width'] : 0;

	$data = get_oembed_response_data( $post_id, $width );

	if ( $switched_blog ) {
		restore_current_blog();
	}

	return $data ? (object) $data : false;
}