Action hook 'set_transient_{$transient}'

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

View Source

set_transient_{$transient}

Action Hook
Description
Fires after the value for a specific transient has been 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 Action
Line Number 1594

Hook Parameters

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

Usage Examples

Basic Usage
<?php
// Hook into set_transient_{$transient}
add_action('set_transient_{$transient}', 'my_custom_function', 10, 3);

function my_custom_function($value, $expiration, $transient) {
    // Your custom code here
}

Source Code Context

wp-includes/option.php:1594 - How this hook is used in WordPress core
<?php
1589  		 *
1590  		 * @param mixed  $value      Transient value.
1591  		 * @param int    $expiration Time until expiration in seconds.
1592  		 * @param string $transient  The name of the transient.
1593  		 */
1594  		do_action( "set_transient_{$transient}", $value, $expiration, $transient );
1595  
1596  		/**
1597  		 * Fires after the value for a transient has been set.
1598  		 *
1599  		 * @since 6.8.0

PHP Documentation

<?php
/**
		 * Fires after the value for a specific transient has been set.
		 *
		 * The dynamic portion of the hook name, `$transient`, refers to the transient name.
		 *
		 * @since 3.0.0
		 * @since 3.6.0 The `$value` and `$expiration` parameters were added.
		 * @since 4.4.0 The `$transient` parameter was added.
		 *
		 * @param mixed  $value      Transient value.
		 * @param int    $expiration Time until expiration in seconds.
		 * @param string $transient  The name of the transient.
		 */
Quick Info
  • Hook Type: Action
  • Parameters: 3
  • File: wp-includes/option.php
Related Hooks

Related hooks will be displayed here in future updates.