oembed_ttl

Filters the oEmbed TTL value (time to live).

Description

apply_filters( 'oembed_ttl', (int) $day_in_seconds, (string) $url, (array) $attr, (int) $post_id ); 

Parameters (4)

0. $day_in_seconds (int) => DAY_IN_SECONDS
Time to live (in seconds).
1. $url (string)
The attempted embed URL.
2. $attr (array)
An array of shortcode attributes.
3. $post_id (int)
The post id.

Usage

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

Defined (1)

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

/wp-includes/class-wp-embed.php  
  1. $ttl = apply_filters( 'oembed_ttl', DAY_IN_SECONDS, $url, $attr, $post_ID );