Filter hook 'pre_set_site_transient_{$transient}'

in WP Core File wp-includes/option.php at line 2635

View Source

pre_set_site_transient_{$transient}

Filter Hook
Description
Filters the value of a specific site transient before it is set. The dynamic portion of the hook name, `$transient`, refers to the transient name.

Hook Information

File Location wp-includes/option.php View on GitHub
Hook Type Filter
Line Number 2635

Hook Parameters

Type Name Description
mixed $value New value of site transient.
string $transient Transient name.

Usage Examples

Basic Usage
<?php
// Hook into pre_set_site_transient_{$transient}
add_filter('pre_set_site_transient_{$transient}', 'my_custom_filter', 10, 2);

function my_custom_filter($value, $transient) {
    // Your custom filtering logic here
    return $value;
}

Source Code Context

wp-includes/option.php:2635 - How this hook is used in WordPress core
<?php
2630  	 * @since 4.4.0 The `$transient` parameter was added.
2631  	 *
2632  	 * @param mixed  $value     New value of site transient.
2633  	 * @param string $transient Transient name.
2634  	 */
2635  	$value = apply_filters( "pre_set_site_transient_{$transient}", $value, $transient );
2636  
2637  	$expiration = (int) $expiration;
2638  
2639  	/**
2640  	 * Filters the expiration for a site transient before its value is set.

PHP Documentation

<?php
/**
	 * Filters the value of a specific site transient before it is set.
	 *
	 * The dynamic portion of the hook name, `$transient`, refers to the transient name.
	 *
	 * @since 3.0.0
	 * @since 4.4.0 The `$transient` parameter was added.
	 *
	 * @param mixed  $value     New value of site transient.
	 * @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.