oembed_ttl filter-hookWC 1.0

This is a WordPress - oembed_ttl hook. The plugin just uses it.

Filter the oEmbed cache time-to-live (TTL).

This filter matches WordPress core's oembed_ttl filter signature:

  • $ttl: Time to live in seconds (default: DAY_IN_SECONDS)
  • $url: The URL being embedded
  • $attr: Attributes array (empty in this context)
  • $post_id: Post ID where embed is used (empty string here since email rendering is not post-specific)

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.

Where the hook is called

Embed::get_videopress_thumbnail()
oembed_ttl
Embed::fetch_embed_page_data()
oembed_ttl
woocommerce/packages/email-editor/src/Integrations/Core/Renderer/Blocks/class-embed.php 644
$cache_ttl = (int) apply_filters( 'oembed_ttl', DAY_IN_SECONDS, $url, array(), '' );
woocommerce/packages/email-editor/src/Integrations/Core/Renderer/Blocks/class-embed.php 730
$cache_ttl = (int) apply_filters( 'oembed_ttl', DAY_IN_SECONDS, $url, array(), '' );

Where the hook is used in WooCommerce

Usage not found.