oembed_result

Filters the HTML returned by the oEmbed provider.

Description

apply_filters( 'oembed_result', (string) $this_data2html_data_url, (string) $url, (array) $args ); 

Parameters (3)

0. $this_data2html_data_url (string)
The this data2html data url.
1. $url (string)
URL of the content to be embedded.
2. $args — Optional. (array)
Arguments, usually passed from a shortcode.

Usage

To run the hook, copy the example below.
  1. $this_data2html_data_url = apply_filters( 'oembed_result', $this_data2html_data_url, $url, $args ); 
  2.  
  3. if ( !empty( $this_data2html_data_url ) ) { 
  4.  
  5. // everything has led up to this point... 
  6.  
  7.  
The following example is for adding a hook callback.
  1. // define the oembed_result callback 
  2. function filter_oembed_result( $this_data2html_data_url, $url, $args ) { 
  3. // make filter magic happen here... 
  4. return $this_data2html_data_url
  5. }; 
  6.  
  7. // add the filter 
  8. add_filter( 'oembed_result', 'filter_oembed_result', 10, 3 ); 
To remove a hook callback, use the example below.
  1. // remove the filter 
  2. remove_filter( 'oembed_result', 'filter_oembed_result', 10, 3 ); 

Defined (1)

The filter is defined in the following location(s).

/wp-includes/class-oembed.php  
  1. return apply_filters( 'oembed_result', $this->data2html( $data, $url ), $url, $args );