Categories
CMS Mastering Development Wordpress

set transient for wp_query and refresh it after 25 minutes

As I have a auto feed website and I decide to use transient for improving website loading
So I have a wp_query and I want to use transient for this query and expire it after 25 minutes

                                <ul>
<?php  
                    $portfolio = new WP_Query(array(
                    'post_status' =>'publish',
                    'post_type' =>'post',
                    'fields' => 'ids',
                    'cat' =>''.$link1.'',
                    'posts_per_page' =>'9'      
                    ));
 if($portfolio->have_posts()) : 
                    while($portfolio->have_posts()) : $portfolio->the_post();?>
<li>
<a href="<?php the_permalink() ?>" target="_blank"><?php the_title(); ?></a>
</li>
<?php endwhile; endif; wp_reset_query(); ?>
</ul>

Leave a Reply

Your email address will not be published. Required fields are marked *