Filter hook 'pre_set_transient_{$transient}'

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

View Source

pre_set_transient_{$transient}

Filter Hook
Description
Filters a specific transient before its value 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 1526

Hook Parameters

Type Name Description
mixed $value New value of transient.
int $expiration Time until expiration in seconds.
string $transient Transient name.

Usage Examples

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

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

Source Code Context

wp-includes/option.php:1526 - How this hook is used in WordPress core
<?php
1521  	 *
1522  	 * @param mixed  $value      New value of transient.
1523  	 * @param int    $expiration Time until expiration in seconds.
1524  	 * @param string $transient  Transient name.
1525  	 */
1526  	$value = apply_filters( "pre_set_transient_{$transient}", $value, $expiration, $transient );
1527  
1528  	/**
1529  	 * Filters the expiration for a transient before its value is set.
1530  	 *
1531  	 * The dynamic portion of the hook name, `$transient`, refers to the transient name.

PHP Documentation

<?php
/**
	 * Filters a specific transient before its value is set.
	 *
	 * The dynamic portion of the hook name, `$transient`, refers to the transient name.
	 *
	 * @since 3.0.0
	 * @since 4.2.0 The `$expiration` parameter was added.
	 * @since 4.4.0 The `$transient` parameter was added.
	 *
	 * @param mixed  $value      New value of transient.
	 * @param int    $expiration Time until expiration in seconds.
	 * @param string $transient  Transient name.
	 */
Quick Info
  • Hook Type: Filter
  • Parameters: 3
  • File: wp-includes/option.php
Related Hooks

Related hooks will be displayed here in future updates.