oembed_ttl
Filter HookDescription
Filters the oEmbed TTL value (time to live).Hook Information
File Location |
wp-includes/class-wp-embed.php
View on GitHub
|
Hook Type | Filter |
Line Number | 249 |
Hook Parameters
Type | Name | Description |
---|---|---|
int
|
$time
|
Time to live (in seconds). |
string
|
$url
|
The attempted embed URL. |
array
|
$attr
|
An array of shortcode attributes. |
int
|
$post_id
|
Post ID. |
Usage Examples
Basic Usage
<?php
// Hook into oembed_ttl
add_filter('oembed_ttl', 'my_custom_filter', 10, 4);
function my_custom_filter($time, $url, $attr, $post_id) {
// Your custom filtering logic here
return $time;
}
Source Code Context
wp-includes/class-wp-embed.php:249
- How this hook is used in WordPress core
<?php
244 * @param int $time Time to live (in seconds).
245 * @param string $url The attempted embed URL.
246 * @param array $attr An array of shortcode attributes.
247 * @param int $post_id Post ID.
248 */
249 $ttl = apply_filters( 'oembed_ttl', DAY_IN_SECONDS, $url, $attr, $post_id );
250
251 $cache = '';
252 $cache_time = 0;
253
254 $cached_post_id = $this->find_oembed_post_id( $key_suffix );
PHP Documentation
<?php
/**
* Filters the oEmbed TTL value (time to live).
*
* @since 4.0.0
*
* @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.
*/
Quick Info
- Hook Type: Filter
- Parameters: 4
- File: wp-includes/class-wp-embed.php
Related Hooks
Related hooks will be displayed here in future updates.