Do I need to reset the loop in this code?
I use the code below, added to a template, to display random posts.
ul
?php $posts = get_posts('orderby=randnumberposts=5'); foreach($posts as $post) { ?
lia href="?php the_permalink(); ?"?php the_title(); ?/a/li
?php } ?
/ul
Do I need to reset, presumably by changing
?php } ?
to
?php } wp_reset_postdata(); ?
And does the need to reset depend on whether this code-block is before or after other loops/queries in the template?
Topic wp-reset-postdata Wordpress
Category Web