set transient for wp_query and refresh it after 25 minutes
Question
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>
0
3 months
2020-11-22T05:10:22-05:00
2020-11-22T05:10:22-05:00 0 Answers
12 views
0
Leave an answer
You must login or register to add a new answer .