Action hook 'set_transient'

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

View Source

set_transient

Action Hook
Description
Fires after the value for a transient has been set.

Hook Information

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

Hook Parameters

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

Usage Examples

Basic Usage
<?php
// Hook into set_transient
add_action('set_transient', 'my_custom_function', 10, 3);

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

Source Code Context

wp-includes/option.php:1605 - How this hook is used in WordPress core
<?php
1600  		 *
1601  		 * @param string $transient  The name of the transient.
1602  		 * @param mixed  $value      Transient value.
1603  		 * @param int    $expiration Time until expiration in seconds.
1604  		 */
1605  		do_action( 'set_transient', $transient, $value, $expiration );
1606  
1607  		/**
1608  		 * Fires after the transient is set.
1609  		 *
1610  		 * @since 3.0.0

PHP Documentation

<?php
/**
		 * Fires after the value for a transient has been set.
		 *
		 * @since 6.8.0
		 *
		 * @param string $transient  The name of the transient.
		 * @param mixed  $value      Transient value.
		 * @param int    $expiration Time until expiration in seconds.
		 */
Quick Info
  • Hook Type: Action
  • Parameters: 3
  • File: wp-includes/option.php
Related Hooks

Related hooks will be displayed here in future updates.