get_oembed_endpoint_url()WP 4.4.0

Retrieves the oEmbed endpoint URL for a given permalink.

Pass an empty string as the first argument to get the endpoint base URL.

Хуки из функции

Возвращает

Строку. The oEmbed endpoint URL.

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

get_oembed_endpoint_url( $permalink, $format );
$permalink(строка)
The permalink used for the url query arg.
По умолчанию: ''
$format(строка)
The requested response format.
По умолчанию: 'json'

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

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

Код get_oembed_endpoint_url() WP 6.6.2

function get_oembed_endpoint_url( $permalink = '', $format = 'json' ) {
	$url = rest_url( 'oembed/1.0/embed' );

	if ( '' !== $permalink ) {
		$url = add_query_arg(
			array(
				'url'    => urlencode( $permalink ),
				'format' => ( 'json' !== $format ) ? $format : false,
			),
			$url
		);
	}

	/**
	 * Filters the oEmbed endpoint URL.
	 *
	 * @since 4.4.0
	 *
	 * @param string $url       The URL to the oEmbed endpoint.
	 * @param string $permalink The permalink used for the `url` query arg.
	 * @param string $format    The requested response format.
	 */
	return apply_filters( 'oembed_endpoint_url', $url, $permalink, $format );
}