Support

Account

Home Forums Backend Issues (wp-admin) Post Object not resetting with wp_reset_postdata() Reply To: Post Object not resetting with wp_reset_postdata()

  • I just ran into the same issue as truheart. However, I utilized WP_Query in my loop to call my custom post type. My code is similar to:

    $args = array( 'post_type' => 'customposttype' );
    $loop = new WP_Query( $args );
    while ( $loop->have_posts() ) : $loop->the_post();

    In this case, I found the way to reset the post data was to run:
    $loop->reset_postdata(); instead of wp_reset_postdata(); (due to the fact I have no global $post object defined).