wp_embed_handler_youtube

Filters the YoutTube embed output.

Description

apply_filters( 'wp_embed_handler_youtube', (string) $embed, (array) $attr, (string) $url, (array) $rawattr ); 

Parameters (4)

0. $embed (string)
YouTube embed output.
1. $attr (array)
An array of embed attributes.
2. $url (string)
The original URL that was matched by the regex.
3. $rawattr (array)
The original unmodified attributes.

Usage

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

Defined (1)

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

/wp-includes/embed.php  
  1. return apply_filters( 'wp_embed_handler_youtube', $embed, $attr, $url, $rawattr );