oembed_ttl хук-фильтрWP 4.0.0

Filters the oEmbed TTL value (time to live).

Использование

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(строка)
The attempted embed URL.
$attr(массив)
An array of shortcode attributes.
$post_id(int)
Post ID.

Список изменений

С версии 4.0.0 Введена.

Где вызывается хук

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

Где используется хук в WordPress

Использование не найдено.