wp_theme_files_cache_ttl
Filter HookDescription
Filters the cache expiration time for theme files.Hook Information
File Location |
wp-includes/class-wp-theme.php
View on GitHub
|
Hook Type | Filter |
Line Number | 2030 |
Hook Parameters
Type | Name | Description |
---|---|---|
int
|
$cache_expiration
|
Cache expiration time in seconds. |
string
|
$cache_type
|
Type of cache being set. |
Usage Examples
Basic Usage
<?php
// Hook into wp_theme_files_cache_ttl
add_filter('wp_theme_files_cache_ttl', 'my_custom_filter', 10, 2);
function my_custom_filter($cache_expiration, $cache_type) {
// Your custom filtering logic here
return $cache_expiration;
}
Source Code Context
wp-includes/class-wp-theme.php:2030
- How this hook is used in WordPress core
<?php
2025 * @since 6.6.0
2026 *
2027 * @param int $cache_expiration Cache expiration time in seconds.
2028 * @param string $cache_type Type of cache being set.
2029 */
2030 $cache_expiration = (int) apply_filters( 'wp_theme_files_cache_ttl', self::$cache_expiration, 'theme_block_patterns' );
2031
2032 // We don't want to cache patterns infinitely.
2033 if ( $cache_expiration <= 0 ) {
2034 _doing_it_wrong(
2035 __METHOD__,
PHP Documentation
<?php
/**
* Filters the cache expiration time for theme files.
*
* @since 6.6.0
*
* @param int $cache_expiration Cache expiration time in seconds.
* @param string $cache_type Type of cache being set.
*/
Quick Info
- Hook Type: Filter
- Parameters: 2
- File: wp-includes/class-wp-theme.php
Related Hooks
Related hooks will be displayed here in future updates.