pre_site_transient_{$transient}
Filter HookDescription
Filters the value of an existing site transient before it is retrieved. The dynamic portion of the hook name, `$transient`, refers to the transient name. Returning a value other than boolean false will short-circuit retrieval and return that value instead.Hook Information
File Location |
wp-includes/option.php
View on GitHub
|
Hook Type | Filter |
Line Number | 2563 |
Hook Parameters
Type | Name | Description |
---|---|---|
mixed
|
$pre_site_transient
|
The default value to return if the site transient does not exist. Any value other than false will short-circuit the retrieval of the transient, and return that value. |
string
|
$transient
|
Transient name. |
Usage Examples
Basic Usage
<?php
// Hook into pre_site_transient_{$transient}
add_filter('pre_site_transient_{$transient}', 'my_custom_filter', 10, 2);
function my_custom_filter($pre_site_transient, $transient) {
// Your custom filtering logic here
return $pre_site_transient;
}
Source Code Context
wp-includes/option.php:2563
- How this hook is used in WordPress core
<?php
2558 * @param mixed $pre_site_transient The default value to return if the site transient does not exist.
2559 * Any value other than false will short-circuit the retrieval
2560 * of the transient, and return that value.
2561 * @param string $transient Transient name.
2562 */
2563 $pre = apply_filters( "pre_site_transient_{$transient}", false, $transient );
2564
2565 if ( false !== $pre ) {
2566 return $pre;
2567 }
2568
PHP Documentation
<?php
/**
* Filters the value of an existing site transient before it is retrieved.
*
* The dynamic portion of the hook name, `$transient`, refers to the transient name.
*
* Returning a value other than boolean false will short-circuit retrieval and
* return that value instead.
*
* @since 2.9.0
* @since 4.4.0 The `$transient` parameter was added.
*
* @param mixed $pre_site_transient The default value to return if the site transient does not exist.
* Any value other than false will short-circuit the retrieval
* of the transient, and return that value.
* @param string $transient Transient name.
*/
Quick Info
- Hook Type: Filter
- Parameters: 2
- File: wp-includes/option.php
Related Hooks
Related hooks will be displayed here in future updates.