wp_reset_postdata()
wp_reset_postdata()
will restores the global $post variable to the current post in the main query. This is useful when using WP_Query
to customize loops or create multiple loops on the same page.
This Answer will solve all your queries about wp_reset_postdata()
& WP_Query
& get_posts