Filter hook 'oembed_fetch_url'

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

View Source

oembed_fetch_url

Filter Hook
Description
Filters the oEmbed URL to be fetched.

Hook Information

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

Hook Parameters

Type Name Description
string $provider URL of the oEmbed provider.
string $url URL of the content to be embedded.
array $args Optional. Additional arguments for retrieving embed HTML. See wp_oembed_get() for accepted arguments. Default empty.

Usage Examples

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

function my_custom_filter($provider, $url, $args) {
    // Your custom filtering logic here
    return $provider;
}

Source Code Context

wp-includes/class-wp-oembed.php:553 - How this hook is used in WordPress core
<?php
 548  		 * @param string $provider URL of the oEmbed provider.
 549  		 * @param string $url      URL of the content to be embedded.
 550  		 * @param array  $args     Optional. Additional arguments for retrieving embed HTML.
 551  		 *                         See wp_oembed_get() for accepted arguments. Default empty.
 552  		 */
 553  		$provider = apply_filters( 'oembed_fetch_url', $provider, $url, $args );
 554  
 555  		foreach ( array( 'json', 'xml' ) as $format ) {
 556  			$result = $this->_fetch_with_format( $provider, $format );
 557  			if ( is_wp_error( $result ) && 'not-implemented' === $result->get_error_code() ) {
 558  				continue;

PHP Documentation

<?php
/**
		 * Filters the oEmbed URL to be fetched.
		 *
		 * @since 2.9.0
		 * @since 4.9.0 The `dnt` (Do Not Track) query parameter was added to all oEmbed provider URLs.
		 *
		 * @param string $provider URL of the oEmbed provider.
		 * @param string $url      URL of the content to be embedded.
		 * @param array  $args     Optional. Additional arguments for retrieving embed HTML.
		 *                         See wp_oembed_get() for accepted arguments. Default empty.
		 */
Quick Info
  • Hook Type: Filter
  • Parameters: 3
  • File: wp-includes/class-wp-oembed.php
Related Hooks

Related hooks will be displayed here in future updates.