WordPress.org

Support

Support » Plugins and Hacks » Recent Posts Widget Extended » [Resolved] Plugin does not dynamically update

[Resolved] Plugin does not dynamically update

Viewing 10 replies - 1 through 10 (of 10 total)
  • Hello,

    Yes it’s normal because the plugin uses custom cache, it will expired in 12 hours 🙂

    Is there any way we can modify this cache expiration timeout?

    @bwhontwerpers please open new thread. Actually you can’t change the cache time, you only need to re-save the widget and the cache will removed

    That’s kind of tedious to have to re-save the widget every time in order for it to refresh itself just so it shows the most recent post…

    You don’t have to…it will dynamically update itself every 12 hours. It is not a big deal.

    Running into this same issue; a 12-hour cache is actually a big deal for sites that update periodically throughout the day.

    I’m sorry, but please read the descriptions once again.

    The recent posts widget extended uses Transients API for delivering cached to optimize your site performance when used the widget.

    The cache is just to optimize your site. Maybe in the next release, I’ll provide an input box to set up the cache time.

    If anyone want to skip the cache thing you can do like me.

    In the plugin folder on line 52 in the file includes/widget-recent-posts-extended.php

    replace this

    if ( false === ( $rpwewidget = get_transient( 'rpwewidget_' . $widget_id ) ) ) {
    
    			$args = array(
    				'numberposts' => $limit,
    				'cat' => $cat,
    				'post_type' => $post_type
    			);
    
    		    $rpwewidget = get_posts( $args );
    
    		    set_transient( 'rpwewidget_' . $widget_id, $rpwewidget, 60*60*12 );
    
    		} ?>

    with this

    /*
    		if ( false === ( $rpwewidget = get_transient( 'rpwewidget_' . $widget_id ) ) ) {
    		*/
    			$args = array(
    				'numberposts' => $limit,
    				'cat' => $cat,
    				'post_type' => $post_type
    			);
    
    		    $rpwewidget = get_posts( $args );
    		/*
    		    set_transient( 'rpwewidget_' . $widget_id, $rpwewidget, 60*60*12 );
    
    		}
    		*/
    		?>

    Thank you ACarlsson! Just what I needed. 🙂

    Brava, ACarlsson. I had actually just edited down the time of the cache, but I think this is actually a better solution.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘[Resolved] Plugin does not dynamically update’ is closed to new replies.
Skip to toolbar