Filter hook 'oembed_remote_get_args'

in WP Core File wp-includes/class-wp-oembed.php at line 580

View Source

oembed_remote_get_args

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

Hook Information

File Location wp-includes/class-wp-oembed.php View on GitHub
Hook Type Filter
Line Number 580

Hook Parameters

Type Name Description
string $provider_url_with_args URL to the provider with full arguments list (url, maxheight, etc.)
string $format Format to use.

Usage Examples

Basic Usage
<?php
// Hook into oembed_remote_get_args
add_filter('oembed_remote_get_args', 'my_custom_filter', 10, 2);

function my_custom_filter($provider_url_with_args, $format) {
    // Your custom filtering logic here
    return $provider_url_with_args;
}

Source Code Context

wp-includes/class-wp-oembed.php:580 - How this hook is used in WordPress core
<?php
 575  	 */
 576  	private function _fetch_with_format( $provider_url_with_args, $format ) {
 577  		$provider_url_with_args = add_query_arg( 'format', $format, $provider_url_with_args );
 578  
 579  		/** This filter is documented in wp-includes/class-wp-oembed.php */
 580  		$args = apply_filters( 'oembed_remote_get_args', array(), $provider_url_with_args );
 581  
 582  		$response = wp_safe_remote_get( $provider_url_with_args, $args );
 583  
 584  		if ( 501 === wp_remote_retrieve_response_code( $response ) ) {
 585  			return new WP_Error( 'not-implemented' );

PHP Documentation

<?php
/**
	 * Fetches result from an oEmbed provider for a specific format and complete provider URL
	 *
	 * @since 3.0.0
	 *
	 * @param string $provider_url_with_args URL to the provider with full arguments list (url, maxheight, etc.)
	 * @param string $format                 Format to use.
	 * @return object|false|WP_Error The result in the form of an object on success, false on failure.
	 */
Quick Info
  • Hook Type: Filter
  • Parameters: 2
  • File: wp-includes/class-wp-oembed.php
Related Hooks

Related hooks will be displayed here in future updates.