函数原型
get_oembed_endpoint_url( string $permalink = ”, string $format = ‘json’ ): string
函数描述
Retrieves the oEmbed endpoint URL for a given permalink.
是否弃用
未弃用
函数参数
-
$permalink
string
Optional - The permalink used for the
urlquery arg.Default:
'' -
$format
string
Optional - The requested response format. Default
'json'.Default:
'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 | Description |
|---|---|
| 4.4.0 | Introduced. |

