Title: Shortcode not resetting query
Last modified: August 31, 2016

---

# Shortcode not resetting query

 *  [klongdesigns](https://wordpress.org/support/users/klongdesigns/)
 * (@klongdesigns)
 * [10 years, 2 months ago](https://wordpress.org/support/topic/shortcode-not-resetting-query/)
 * When we are using the shortcode [show_testimonials], and also filtering the title,
   the title becomes the final testimonial title, instead of the page it resides
   on.
 * After troubleshooting, we discovered that on the shortcode portion, you have 
   a query, but you don’t reset the postdata, so once the shortcode is run, the 
   global title for get_the_title() is the title of the last testimonial.
 * To fix this, at the end of the shortcode, I added “wp_reset_postdata()”:
 *     ```
       endwhile;
          $result .= '</ul>';
        wp_reset_postdata();
           return $result;
       ```
   
 * This fixed the issue for me, and you may want to include this fix on a future
   release.
 * [https://wordpress.org/plugins/testimonialslider/](https://wordpress.org/plugins/testimonialslider/)

The topic ‘Shortcode not resetting query’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/testimonialslider_cfe8d7.svg)
 * [Testimonials Slider](https://wordpress.org/plugins/testimonialslider/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/testimonialslider/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/testimonialslider/)
 * [Active Topics](https://wordpress.org/support/plugin/testimonialslider/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/testimonialslider/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/testimonialslider/reviews/)

 * 0 replies
 * 1 participant
 * Last reply from: [klongdesigns](https://wordpress.org/support/users/klongdesigns/)
 * Last activity: [10 years, 2 months ago](https://wordpress.org/support/topic/shortcode-not-resetting-query/)
 * Status: not resolved