Title: WP_oEmbed::_fetch_with_format
Published: April 25, 2014
Last modified: August 20, 2026

---

# WP_oEmbed::_fetch_with_format( string $provider_url_with_args, string $format ): object|false|󠀁[WP_Error](https://developer.wordpress.org/reference/classes/wp_error/)󠁿

## In this article

 * [Parameters](https://developer.wordpress.org/reference/classes/wp_oembed/_fetch_with_format/?output_format=md#parameters)
 * [Return](https://developer.wordpress.org/reference/classes/wp_oembed/_fetch_with_format/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/classes/wp_oembed/_fetch_with_format/?output_format=md#source)
 * [Hooks](https://developer.wordpress.org/reference/classes/wp_oembed/_fetch_with_format/?output_format=md#hooks)
 * [Related](https://developer.wordpress.org/reference/classes/wp_oembed/_fetch_with_format/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/classes/wp_oembed/_fetch_with_format/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/classes/wp_oembed/_fetch_with_format/?output_format=md#wp--skip-link--target)

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

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

## 󠀁[Parameters](https://developer.wordpress.org/reference/classes/wp_oembed/_fetch_with_format/?output_format=md#parameters)󠁿

 `$provider_url_with_args`stringrequired

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

`$format`stringrequired

Format to use.

## 󠀁[Return](https://developer.wordpress.org/reference/classes/wp_oembed/_fetch_with_format/?output_format=md#return)󠁿

 object|false|[WP_Error](https://developer.wordpress.org/reference/classes/wp_error/)
The result in the form of an object on success, false on failure.

## 󠀁[Source](https://developer.wordpress.org/reference/classes/wp_oembed/_fetch_with_format/?output_format=md#source)󠁿

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

[View all references](https://developer.wordpress.org/reference/files/wp-includes/class-wp-oembed.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.1/src/wp-includes/class-wp-oembed.php#L628)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.1/src/wp-includes/class-wp-oembed.php#L628-L648)

## 󠀁[Hooks](https://developer.wordpress.org/reference/classes/wp_oembed/_fetch_with_format/?output_format=md#hooks)󠁿

 [apply_filters( ‘oembed_remote_get_args’, array $args, string $url )](https://developer.wordpress.org/reference/hooks/oembed_remote_get_args/)

Filters oEmbed remote get arguments.

## 󠀁[Related](https://developer.wordpress.org/reference/classes/wp_oembed/_fetch_with_format/?output_format=md#related)󠁿

| Uses | Description | 
| [wp_safe_remote_get()](https://developer.wordpress.org/reference/functions/wp_safe_remote_get/)`wp-includes/http.php` |

Retrieves the raw response from a safe HTTP request using the GET method.

  | 
| [wp_remote_retrieve_response_code()](https://developer.wordpress.org/reference/functions/wp_remote_retrieve_response_code/)`wp-includes/http.php` |

Retrieves only the response code from the raw response.

  | 
| [wp_remote_retrieve_body()](https://developer.wordpress.org/reference/functions/wp_remote_retrieve_body/)`wp-includes/http.php` |

Retrieves only the body from the raw response.

  | 
| [add_query_arg()](https://developer.wordpress.org/reference/functions/add_query_arg/)`wp-includes/functions.php` |

Retrieves a modified URL query string.

  | 
| [apply_filters()](https://developer.wordpress.org/reference/functions/apply_filters/)`wp-includes/plugin.php` |

Calls the callback functions that have been added to a filter hook.

  | 
| [WP_Error::__construct()](https://developer.wordpress.org/reference/classes/wp_error/__construct/)`wp-includes/class-wp-error.php` |

Initializes the error.

  |

[Show 3 more](https://developer.wordpress.org/reference/classes/wp_oembed/_fetch_with_format/?output_format=md#)
[Show less](https://developer.wordpress.org/reference/classes/wp_oembed/_fetch_with_format/?output_format=md#)

| Used by | Description | 
| [WP_oEmbed::fetch()](https://developer.wordpress.org/reference/classes/wp_oembed/fetch/)`wp-includes/class-wp-oembed.php` |

Connects to an oEmbed provider and returns the result.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/classes/wp_oembed/_fetch_with_format/?output_format=md#changelog)󠁿

| Version | Description | 
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_oembed%2F_fetch_with_format%2F)
before being able to contribute a note or feedback.