Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.

WP_oEmbed::_fetch_with_format( string $provider_url_with_args, string $format )

Fetches result from an oEmbed provider for a specific format and complete provider URL


Description Description


Parameters Parameters

$provider_url_with_args

(string) (Required) URL to the provider with full arguments list (url, maxheight, etc.)

$format

(string) (Required) Format to use


Top ↑

Return Return

(false|object|WP_Error) False on failure, otherwise the result in the form of an object.


Top ↑

Source Source

File: wp-includes/class-oembed.php

	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-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' );
		}
		if ( ! $body = wp_remote_retrieve_body( $response ) ) {
			return false;
		}
		$parse_method = "_parse_$format";
		return $this->$parse_method( $body );
	}

Top ↑

Changelog Changelog

Changelog
Version Description
3.0.0 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.