oembed_ttl filter-hookWP 4.0.0

Filters the oEmbed TTL value (time to live).

Usage

add_filter( 'oembed_ttl', 'wp_kama_oembed_ttl_filter', 10, 4 );

/**
 * Function for `oembed_ttl` filter-hook.
 * 
 * @param int    $time    Time to live (in seconds).
 * @param string $url     The attempted embed URL.
 * @param array  $attr    An array of shortcode attributes.
 * @param int    $post_id Post ID.
 *
 * @return int
 */
function wp_kama_oembed_ttl_filter( $time, $url, $attr, $post_id ){

	// filter...
	return $time;
}
$time(int)
Time to live (in seconds).
$url(string)
The attempted embed URL.
$attr(array)
An array of shortcode attributes.
$post_id(int)
Post ID.

Changelog

Since 4.0.0 Introduced.

Where the hook is called

WP_Embed::shortcode()
oembed_ttl
wp-includes/class-wp-embed.php 249
$ttl = apply_filters( 'oembed_ttl', DAY_IN_SECONDS, $url, $attr, $post_id );

Where the hook is used in WordPress

Usage not found.