Introduce an oembed_fetch_url filter to be applied before sending the request.

props Otto42, r-a-y. fixes #16996.



git-svn-id: https://develop.svn.wordpress.org/trunk@21839 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Nacin 2012-09-13 17:45:36 +00:00
parent f62839c45b
commit c2df87ff7d

View File

@ -163,6 +163,8 @@ class WP_oEmbed {
$provider = add_query_arg( 'maxheight', (int) $args['height'], $provider ); $provider = add_query_arg( 'maxheight', (int) $args['height'], $provider );
$provider = add_query_arg( 'url', urlencode($url), $provider ); $provider = add_query_arg( 'url', urlencode($url), $provider );
$provider = apply_filters( 'oembed_fetch_url', $provider, $args, $url );
foreach( array( 'json', 'xml' ) as $format ) { foreach( array( 'json', 'xml' ) as $format ) {
$result = $this->_fetch_with_format( $provider, $format ); $result = $this->_fetch_with_format( $provider, $format );
if ( is_wp_error( $result ) && 'not-implemented' == $result->get_error_code() ) if ( is_wp_error( $result ) && 'not-implemented' == $result->get_error_code() )