WP_oEmbed::_fetch_with_format()
Fetches result from an oEmbed provider for a specific format and complete provider URL
Method of the class: WP_oEmbed{}
Hooks from the method
Return
Object|false|WP_Error
. The result in the form of an object on success, false on failure.
Usage
// private - for code of main (parent) class only $result = $this->_fetch_with_format( $provider_url_with_args, $format );
- $provider_url_with_args(string) (required)
- URL to the provider with full arguments list (url, maxheight, etc.)
- $format(string) (required)
- Format to use.
Changelog
Since 3.0.0 | Introduced. |
WP_oEmbed::_fetch_with_format() WP oEmbed:: fetch with format code WP 6.5.2
private function _fetch_with_format( $provider_url_with_args, $format ) { $provider_url_with_args = add_query_arg( 'format', $format, $provider_url_with_args ); /** This filter is documented in wp-includes/class-wp-oembed.php */ $args = apply_filters( 'oembed_remote_get_args', array(), $provider_url_with_args ); $response = wp_safe_remote_get( $provider_url_with_args, $args ); if ( 501 === wp_remote_retrieve_response_code( $response ) ) { return new WP_Error( 'not-implemented' ); } $body = wp_remote_retrieve_body( $response ); if ( ! $body ) { return false; } $parse_method = "_parse_$format"; return $this->$parse_method( $body ); }