WordPress.org

Make WordPress Core

Changeset 34865


Ignore:
Timestamp:
10/06/2015 02:10:00 PM (4 years ago)
Author:
wonderboymusic
Message:

Transients, add filters for $expiration:

  • 'expiration_pre_set_site_transient_' . $transient
  • 'expiration_pre_set_transient_' . $transient


Props chriscct7, wpsmith, nacin.
Fixes #21330.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/option.php

    r34828 r34865  
    695695     */
    696696    $value = apply_filters( 'pre_set_transient_' . $transient, $value, $expiration, $transient );
     697
     698    /**
     699     * Filter the expiration for a transient before its value is set.
     700     *
     701     * The dynamic portion of the hook name, `$transient`, refers to the transient name.
     702     *
     703     * @since 4.4.0
     704     *
     705     * @param mixed  $value      New value of transient.
     706     * @param int    $expiration Time until expiration in seconds.
     707     * @param string $transient  Transient name.
     708     */
     709    $expiration = apply_filters( 'expiration_pre_set_transient_' . $transient, $expiration, $value, $transient );
    697710
    698711    if ( wp_using_ext_object_cache() ) {
     
    15901603    $expiration = (int) $expiration;
    15911604
     1605    /**
     1606     * Filter the expiration for a transient before its value is set.
     1607     *
     1608     * The dynamic portion of the hook name, `$transient`, refers to the transient name.
     1609     *
     1610     * @since 4.4.0
     1611     *
     1612     * @param mixed  $value      New value of transient.
     1613     * @param int    $expiration Time until expiration in seconds.
     1614     * @param string $transient  Transient name.
     1615     */
     1616    $expiration = apply_filters( 'expiration_pre_set_site_transient_' . $transient, $expiration, $value, $transient ); 
     1617
    15921618    if ( wp_using_ext_object_cache() ) {
    15931619        $result = wp_cache_set( $transient, $value, 'site-transient', $expiration );
Note: See TracChangeset for help on using the changeset viewer.