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

---

# Needs Output Buffering

 *  Resolved [JoshRowland](https://wordpress.org/support/users/joshrowland/)
 * (@joshrowland)
 * [11 years, 11 months ago](https://wordpress.org/support/topic/needs-output-buffering/)
 * This plugin is great and is really close to what I needed. I did have to modify
   it a little bit to make it work. The current plugin uses dynamic_sidebar() function
   which is outputting content outside of your $value variable and isn’t returned
   with the function.
 * By adding ob_start() and ob_get_contents you can save this output and return 
   it properly within your div. (If you look now, the <div id=”secondary”> gets 
   displayed after the sidebar)
 * Here is the final code change to make this work so that ACF functions get_field(
   returns the html) and the_field (displays the html) work properly.
 *     ```
       <br />
       function format_value_for_api($value, $post_id, $field)<br />
       {<br />
       	$value = '';<br />
       	if ( is_active_sidebar( $field['value'] ) ) :<br />
       		$value .= '<div id="secondary" class="widget-area" role="complementary">';<br />
       			ob_start();<br />
       			dynamic_sidebar( $field['value'] );<br />
       			$value .= ob_get_contents();<br />
       			ob_end_clean();<br />
       		$value .= '</div><!-- #secondary -->';<br />
       	endif;<br />
       	return $value;<br />
       }<br />
       ```
   
 * [https://wordpress.org/plugins/advanced-custom-fields-widget-area-field/](https://wordpress.org/plugins/advanced-custom-fields-widget-area-field/)

Viewing 1 replies (of 1 total)

 *  Plugin Author [Dustin Filippini](https://wordpress.org/support/users/dustyf/)
 * (@dustyf)
 * [11 years, 8 months ago](https://wordpress.org/support/topic/needs-output-buffering/#post-5058895)
 * As of v1.0, I have fixed this issue. Thanks.

Viewing 1 replies (of 1 total)

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

 * ![](https://s.w.org/plugins/geopattern-icon/advanced-custom-fields-widget-area-
   field.svg)
 * [Advanced Custom Fields: Widget Area Field](https://wordpress.org/plugins/advanced-custom-fields-widget-area-field/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/advanced-custom-fields-widget-area-field/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/advanced-custom-fields-widget-area-field/)
 * [Active Topics](https://wordpress.org/support/plugin/advanced-custom-fields-widget-area-field/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/advanced-custom-fields-widget-area-field/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/advanced-custom-fields-widget-area-field/reviews/)

## Tags

 * [ACF](https://wordpress.org/support/topic-tag/acf/)
 * [widget area](https://wordpress.org/support/topic-tag/widget-area/)

 * 1 reply
 * 2 participants
 * Last reply from: [Dustin Filippini](https://wordpress.org/support/users/dustyf/)
 * Last activity: [11 years, 8 months ago](https://wordpress.org/support/topic/needs-output-buffering/#post-5058895)
 * Status: resolved