Title: rest_url_details_cache_expiration
Published: February 3, 2022
Last modified: February 24, 2026

---

# apply_filters( ‘rest_url_details_cache_expiration’, int $ttl )

## In this article

 * [Description](https://developer.wordpress.org/reference/hooks/rest_url_details_cache_expiration/?output_format=md#description)
 * [Parameters](https://developer.wordpress.org/reference/hooks/rest_url_details_cache_expiration/?output_format=md#parameters)
 * [Source](https://developer.wordpress.org/reference/hooks/rest_url_details_cache_expiration/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/hooks/rest_url_details_cache_expiration/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/hooks/rest_url_details_cache_expiration/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/hooks/rest_url_details_cache_expiration/?output_format=md#wp--skip-link--target)

Filters the cache expiration.

## 󠀁[Description](https://developer.wordpress.org/reference/hooks/rest_url_details_cache_expiration/?output_format=md#description)󠁿

Can be used to adjust the time until expiration in seconds for the cache of the 
data retrieved for the given URL.

## 󠀁[Parameters](https://developer.wordpress.org/reference/hooks/rest_url_details_cache_expiration/?output_format=md#parameters)󠁿

 `$ttl`int

The time until cache expiration in seconds.

## 󠀁[Source](https://developer.wordpress.org/reference/hooks/rest_url_details_cache_expiration/?output_format=md#source)󠁿

    ```php
    $cache_expiration = apply_filters( 'rest_url_details_cache_expiration', $ttl );
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/rest-api/endpoints/class-wp-rest-url-details-controller.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/6.9.4/src/wp-includes/rest-api/endpoints/class-wp-rest-url-details-controller.php#L479)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/rest-api/endpoints/class-wp-rest-url-details-controller.php#L479-L479)

## 󠀁[Related](https://developer.wordpress.org/reference/hooks/rest_url_details_cache_expiration/?output_format=md#related)󠁿

| Used by | Description | 
| [WP_REST_URL_Details_Controller::set_cache()](https://developer.wordpress.org/reference/classes/wp_rest_url_details_controller/set_cache/)`wp-includes/rest-api/endpoints/class-wp-rest-url-details-controller.php` |

Utility function to cache a given data set at a given cache key.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/hooks/rest_url_details_cache_expiration/?output_format=md#changelog)󠁿

| Version | Description | 
| [5.9.0](https://developer.wordpress.org/reference/since/5.9.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Frest_url_details_cache_expiration%2F)
before being able to contribute a note or feedback.