I have a few WordPress sites I manage and I am trying to show current posts in a box on another page. The code works but will not update to the new posts. It has been stuck on the old post for quite some time now. Here is the code I am using.
<?php
$args = array(
'slug' => 'news',
'url' => 'metnews.org',
'type' => 'post'
);
$news = get_transient( 'news-json' );
if ( $news == false ) {
$news = get_remote_post( $args );
set_transient( 'news-json', $news, 60*60*3 );
}
echo $news;
?>
Thanks.