wp_cache_themes_persistently
Filter HookDescription
Constructor for WP_Theme.Hook Information
File Location |
wp-includes/class-wp-theme.php
View on GitHub
|
Hook Type | Filter |
Line Number | 257 |
Hook Parameters
Type | Name | Description |
---|---|---|
string
|
$theme_dir
|
Directory of the theme within the theme_root. |
string
|
$theme_root
|
Theme root. |
WP_Theme|null
|
$_child
|
If this theme is a parent theme, the child may be passed for validation purposes. |
Usage Examples
Basic Usage
<?php
// Hook into wp_cache_themes_persistently
add_filter('wp_cache_themes_persistently', 'my_custom_filter', 10, 3);
function my_custom_filter($theme_dir, $theme_root, $_child) {
// Your custom filtering logic here
return $theme_dir;
}
Source Code Context
wp-includes/class-wp-theme.php:257
- How this hook is used in WordPress core
<?php
252 global $wp_theme_directories;
253
254 // Initialize caching on first run.
255 if ( ! isset( self::$persistently_cache ) ) {
256 /** This action is documented in wp-includes/theme.php */
257 self::$persistently_cache = apply_filters( 'wp_cache_themes_persistently', false, 'WP_Theme' );
258 if ( self::$persistently_cache ) {
259 wp_cache_add_global_groups( 'themes' );
260 if ( is_int( self::$persistently_cache ) ) {
261 self::$cache_expiration = self::$persistently_cache;
262 }
PHP Documentation
<?php
/**
* Constructor for WP_Theme.
*
* @since 3.4.0
*
* @global string[] $wp_theme_directories
*
* @param string $theme_dir Directory of the theme within the theme_root.
* @param string $theme_root Theme root.
* @param WP_Theme|null $_child If this theme is a parent theme, the child may be passed for validation purposes.
*/
Quick Info
- Hook Type: Filter
- Parameters: 3
- File: wp-includes/class-wp-theme.php
Related Hooks
Related hooks will be displayed here in future updates.