rest_oembed_ttl
Filter HookDescription
Filters the oEmbed TTL value (time to live). Similar to the {@see 'oembed_ttl'} filter, but for the REST API oEmbed proxy endpoint.Hook Information
File Location |
wp-includes/class-wp-oembed-controller.php
View on GitHub
|
Hook Type | Filter |
Line Number | 240 |
Hook Parameters
Type | Name | Description |
---|---|---|
int
|
$time
|
Time to live (in seconds). |
string
|
$url
|
The attempted embed URL. |
array
|
$args
|
An array of embed request arguments. |
Usage Examples
Basic Usage
<?php
// Hook into rest_oembed_ttl
add_filter('rest_oembed_ttl', 'my_custom_filter', 10, 3);
function my_custom_filter($time, $url, $args) {
// Your custom filtering logic here
return $time;
}
Source Code Context
wp-includes/class-wp-oembed-controller.php:240
- How this hook is used in WordPress core
<?php
235 *
236 * @param int $time Time to live (in seconds).
237 * @param string $url The attempted embed URL.
238 * @param array $args An array of embed request arguments.
239 */
240 $ttl = apply_filters( 'rest_oembed_ttl', DAY_IN_SECONDS, $url, $args );
241
242 set_transient( $cache_key, $data, $ttl );
243
244 return $data;
245 }
PHP Documentation
<?php
/**
* Filters the oEmbed TTL value (time to live).
*
* Similar to the {@see 'oembed_ttl'} filter, but for the REST API
* oEmbed proxy endpoint.
*
* @since 4.8.0
*
* @param int $time Time to live (in seconds).
* @param string $url The attempted embed URL.
* @param array $args An array of embed request arguments.
*/
Quick Info
- Hook Type: Filter
- Parameters: 3
- File: wp-includes/class-wp-oembed-controller.php
Related Hooks
Related hooks will be displayed here in future updates.