get_oembed_endpoint_url() - WordPress 函数参考中文文档

返回介绍

get_oembed_endpoint_url()

发布于 2017-09-10 字数2134 浏览 944 评论 0

get_oembed_endpoint_url( string $permalink = '',  string $format = 'json' )

Retrieves the oEmbed endpoint URL for a given permalink.


描述

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


参数

$permalink

(string)
(Optional)
The permalink used for the url query arg.

Default value: ”

$format

(string)
(Optional)
The requested response format.

Default value: ‘json’


返回值

(string) The oEmbed endpoint URL.


源代码

File: wp-includes/embed.php

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

更新日志

Version 描述
4.4.0 Introduced.

相关函数

Uses

  • wp-includes/rest-api.php:
    rest_url()
  • wp-includes/embed.php:
    oembed_endpoint_url
  • wp-includes/functions.php:
    add_query_arg()
  • wp-includes/plugin.php:
    apply_filters()

Used By

  • wp-includes/embed.php:
    wp_oembed_add_discovery_links()

User Contributed Notes

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

目前还没有任何评论,快来抢沙发吧!