Filter hook 'rest_url_details_cache_expiration'

in WP Core File wp-includes/rest-api/endpoints/class-wp-rest-url-details-controller.php at line 479

View Source

rest_url_details_cache_expiration

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

Hook Information

File Location wp-includes/rest-api/endpoints/class-wp-rest-url-details-controller.php View on GitHub
Hook Type Filter
Line Number 479

Hook Parameters

Type Name Description
int $ttl The time until cache expiration in seconds.

Usage Examples

Basic Usage
<?php
// Hook into rest_url_details_cache_expiration
add_filter('rest_url_details_cache_expiration', 'my_custom_filter', 10, 1);

function my_custom_filter($ttl) {
    // Your custom filtering logic here
    return $ttl;
}

Source Code Context

wp-includes/rest-api/endpoints/class-wp-rest-url-details-controller.php:479 - How this hook is used in WordPress core
<?php
 474  		 *
 475  		 * @since 5.9.0
 476  		 *
 477  		 * @param int $ttl The time until cache expiration in seconds.
 478  		 */
 479  		$cache_expiration = apply_filters( 'rest_url_details_cache_expiration', $ttl );
 480  
 481  		return set_site_transient( $key, $data, $cache_expiration );
 482  	}
 483  
 484  	/**

PHP Documentation

<?php
/**
		 * Filters the cache expiration.
		 *
		 * Can be used to adjust the time until expiration in seconds for the cache
		 * of the data retrieved for the given URL.
		 *
		 * @since 5.9.0
		 *
		 * @param int $ttl The time until cache expiration in seconds.
		 */
Quick Info
  • Hook Type: Filter
  • Parameters: 1
  • File: wp-includes/rest-api/endpoints/class-wp-rest-url-details-controller.php
Related Hooks

Related hooks will be displayed here in future updates.