wp_theme_files_cache_ttl
云策文档标注
概述
wp_theme_files_cache_ttl 是一个 WordPress 过滤器,用于修改主题文件缓存的有效期时间。它允许开发者自定义缓存过期时间,以优化性能或适应特定需求。
关键要点
- 过滤器名称:wp_theme_files_cache_ttl
- 参数:$cache_expiration(整数,缓存过期时间,单位秒)和 $cache_type(字符串,缓存类型)
- 用途:主要用于主题块模式缓存,如 WP_Theme::set_pattern_cache() 方法中
- 引入版本:WordPress 6.6.0
代码示例
$cache_expiration = (int) apply_filters( 'wp_theme_files_cache_ttl', self::$cache_expiration, 'theme_block_patterns' );
原文内容
Filters the cache expiration time for theme files.
Parameters
$cache_expirationint-
Cache expiration time in seconds.
$cache_typestring-
Type of cache being set.
Source
$cache_expiration = (int) apply_filters( 'wp_theme_files_cache_ttl', self::$cache_expiration, 'theme_block_patterns' );
Changelog
| Version | Description |
|---|---|
| 6.6.0 | Introduced. |