WordPress.org

Make WordPress Core

Ticket #21330: 21330_opt4.patch

File 21330_opt4.patch, 919 bytes (added by wpsmith, 3 years ago)

Option 4: Combo of Option 3 & modified Option 1

  • option.php

     
    10211021function set_site_transient( $transient, $value, $expiration = 0 ) { 
    10221022        global $_wp_using_ext_object_cache; 
    10231023 
    1024         $value = apply_filters( 'pre_set_site_transient_' . $transient, $value ); 
     1024        $value      = apply_filters( 'pre_set_site_transient_' . $transient, $value ); 
     1025        $expiration = apply_filters( 'pre_set_site_transient_exp_' . $transient, $expiration ); 
     1026        $options    = apply_filters( 'pre_set_site_transient_' . $transient, null, array( 'value' => $value, 'expiration' =>$expiration ) ); 
     1027        if ( is_array( $options ) && null != $options ) ) { 
     1028                $value = $options['value']; 
     1029                $expiration = $options['expiration']; 
     1030        } 
    10251031 
    10261032        if ( $_wp_using_ext_object_cache ) { 
    10271033                $result = wp_cache_set( $transient, $value, 'site-transient', $expiration );