Title: Output Buffering Bug
Last modified: August 21, 2016

---

# Output Buffering Bug

 *  [rphelan](https://wordpress.org/support/users/rphelan/)
 * (@rphelan)
 * [12 years, 3 months ago](https://wordpress.org/support/topic/output-buffering-bug/)
 * I attempted to use this widget in a theme that is using output buffering and 
   it is not playing nicely. In my case, the other widgets were being output at 
   completely random parts of the page (outside of the sidebar).
 * The issue is here:
 *     ```
       if ($cache) {
         $cache[$args['widget_id']] = ob_get_flush();
       }
       ```
   
 * You’re not always clearing the buffer, and when you are, you’re clearing ALL 
   buffers. I was able to fix by replacing with this:
 *     ```
       $widget_output = ob_get_clean();
       if ($cache) {
         $cache[$args['widget_id']] = $widget_output;
       }
       echo $widget_output;
       ```
   
 * That way, it always cleans up when it’s done and doesn’t interfere with any external
   output buffers.
 * [https://wordpress.org/plugins/ultimate-posts-widget/](https://wordpress.org/plugins/ultimate-posts-widget/)

The topic ‘Output Buffering Bug’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/ultimate-posts-widget_5b9f2b.svg)
 * [Ultimate Posts Widget](https://wordpress.org/plugins/ultimate-posts-widget/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/ultimate-posts-widget/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/ultimate-posts-widget/)
 * [Active Topics](https://wordpress.org/support/plugin/ultimate-posts-widget/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/ultimate-posts-widget/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/ultimate-posts-widget/reviews/)

 * 0 replies
 * 1 participant
 * Last reply from: [rphelan](https://wordpress.org/support/users/rphelan/)
 * Last activity: [12 years, 3 months ago](https://wordpress.org/support/topic/output-buffering-bug/)
 * Status: not resolved