Is it necessary to reset the query after using get_posts()?

Is it necessary to reset the query after using get_posts() ?

I have been looking at this page and I don’t see any reference to get_posts() … I can’t make it out for sure from this page either.

Read More

I can’t see why it wouldn’t be necessary ( though on my test page it doesnt cause any problems without wp_reset_postsdata() `wp_reset_query()’ or ”rewind_posts()’ ) but if it is which is the right function(s) to use.

Related posts

Leave a Reply

1 comment

  1. No. get_posts() does not modify global $wp_query variable and it doesn’t need to be cleaned up.

    Note that if you further use setup_postdata() you do need to wp_reset_postdata() afterwards.