Viewing 4 replies - 1 through 4 (of 4 total)
  • I have the same question. We would like to show popular posts in the last few hours and we would need the cache to update every few hours. Would you be so kind to explain how to do it? Thanks.

    I guess I found it. Change the DAY_IN_SECONDS to HOUR_IN_SECONDS?

    $cache_expiration = apply_filters( 'gtc_top_content_shortcode_cache_expiration', DAY_IN_SECONDS );
    		set_transient( $trans_id, $list, $cache_expiration );
    Plugin Author Justin Sternberg

    (@jtsternberg)

    Please do not modify the plugin. The filter is there so that you don’t have to modify the plugin. You can add this to your theme’s functions.php file:

    function gtc_top_content_shortcode_cache_expiration_modify( $cache_expiration ) {
    
    	$cache_expiration = HOUR_IN_SECONDS;
    	return $cache_expiration;
    }
    add_filter( 'gtc_top_content_shortcode_cache_expiration', 'gtc_top_content_shortcode_cache_expiration_modify' );

    Thanks a lot Justin, I modified the functions.php file.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How can I change time the cache’ is closed to new replies.