Title: Uprotected loop
Last modified: April 14, 2020

---

# Uprotected loop

 *  [skeemer](https://wordpress.org/support/users/skeemer/)
 * (@skeemer)
 * [6 years, 1 month ago](https://wordpress.org/support/topic/uprotected-loop/)
 * In includes/bp-members.php, there is an unprotected loop that is creating problems
   on our site. It appears that everything within the loop explicitly uses the post
   object or post id. I was able to fix the problem by changing $query->the_post()
   to $query->next_post() which does the same thing without messing up the surrounding
   state.
 * Line 188:
    `while ( $query->have_posts() ) : $query->the_post();` `while ( $query-
   >have_posts() ) : $query->next_post();`
 * Please make this change or make sure that you aren’t blowing up the state outside
   of the function.

Viewing 1 replies (of 1 total)

 *  Plugin Author [learningtimes](https://wordpress.org/support/users/learningtimes/)
 * (@learningtimes)
 * [6 years, 1 month ago](https://wordpress.org/support/topic/uprotected-loop/#post-12679559)
 * Hi [@skeemer](https://wordpress.org/support/users/skeemer/)
 * We will fix the issue in the next update.
 * Thanks for pointing us to this.

Viewing 1 replies (of 1 total)

The topic ‘Uprotected loop’ is closed to new replies.

 * ![](https://ps.w.org/badgeos-community-add-on/assets/icon-256x256.png?rev=1437049)
 * [BadgeOS Community Add-on](https://wordpress.org/plugins/badgeos-community-add-on/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/badgeos-community-add-on/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/badgeos-community-add-on/)
 * [Active Topics](https://wordpress.org/support/plugin/badgeos-community-add-on/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/badgeos-community-add-on/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/badgeos-community-add-on/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [learningtimes](https://wordpress.org/support/users/learningtimes/)
 * Last activity: [6 years, 1 month ago](https://wordpress.org/support/topic/uprotected-loop/#post-12679559)
 * Status: not resolved