Title: output buffer error
Last modified: December 1, 2022

---

# output buffer error

 *  Resolved [Gabor](https://wordpress.org/support/users/nextendweb_gabor/)
 * (@nextendweb_gabor)
 * [3 years, 6 months ago](https://wordpress.org/support/topic/output-buffer-error-2/)
 * Hi! There seems to be an error in your code, within this file:
    wp-content\plugins\
   post-grid\includes\classes\class-admin-notices.php from line 33. you have a similar
   code structure:
 *     ```
       if ($screen->id == 'edit-post_grid_layout' ... ) :
   
       	ob_start();
   
       	if ( ... ) :
               ...
       	endif;
   
       endif;
   
       echo(ob_get_clean());
       ```
   
 * The problem with this is, that you have “ob_get_clean” outside the “if”, where“
   ob_start” is. This way when you won’t go inside that “if”, you are closing the
   output buffer which wasn’t started by you. So the fix I’m suggesting is this:
 *     ```
       if ($screen->id == 'edit-post_grid_layout' ... ) :
   
       	ob_start();
   
       	if ( ... ) :
               ...
       	endif;
   
       	echo(ob_get_clean());
   
       endif;
       ```
   
 * to move the “ob_get_clean” inside the “if” too. Would it be possible for you 
   to modify your code to this?
 * If you need a test, you could use for example this code within the functions.
   php file of your theme:
 *     ```
       add_action('admin_notices', 'start_test', 1);
       add_action('admin_notices', 'end_test', 11);
   
       function start_test() {
       	ob_start();
       }
   
       function end_test() {
       	ob_get_clean();
       }
       ```
   
 * and visit a page, where your “if” doesn’t runs, like in the wp-admin area the
   Posts or Plugins page. This code will mess up the page, until the fix is done.

Viewing 4 replies - 1 through 4 (of 4 total)

 *  [rossty](https://wordpress.org/support/users/rossty/)
 * (@rossty)
 * [3 years, 6 months ago](https://wordpress.org/support/topic/output-buffer-error-2/#post-16253573)
 * Hi where can I paste this code on my site?
 *     ```
       if ($screen->id == 'edit-post_grid_layout' ... ) :
   
       	ob_start();
   
       	if ( ... ) :
               ...
       	endif;
   
       	echo(ob_get_clean());
   
       endif;
       ```
   
 *  Thread Starter [Gabor](https://wordpress.org/support/users/nextendweb_gabor/)
 * (@nextendweb_gabor)
 * [3 years, 6 months ago](https://wordpress.org/support/topic/output-buffer-error-2/#post-16253837)
 * Hi [@rossty](https://wordpress.org/support/users/rossty/)!
 * I see you have created a ticket for your issue:
    [https://wordpress.org/support/topic/smart-slider-3-admin-page-crashed-with-this-error-cannot-modify-header-informat/](https://wordpress.org/support/topic/smart-slider-3-admin-page-crashed-with-this-error-cannot-modify-header-informat/)
 * I will rather reply there, to keep this ticket for Post Grid Combo developers
   only.
 *  [azizulraju](https://wordpress.org/support/users/azizulraju/)
 * (@azizulraju)
 * [3 years, 6 months ago](https://wordpress.org/support/topic/output-buffer-error-2/#post-16257239)
 * Hi [@nextendweb_gabor](https://wordpress.org/support/users/nextendweb_gabor/),
   
   Thanks for providing the code. We have updated the plugin. Could you please install
   the latest version 2.2.5, and give it a try?
 *  Thread Starter [Gabor](https://wordpress.org/support/users/nextendweb_gabor/)
 * (@nextendweb_gabor)
 * [3 years, 6 months ago](https://wordpress.org/support/topic/output-buffer-error-2/#post-16261315)
 * Yes, that solved the problem. Thank you!

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘output buffer error’ is closed to new replies.

 * ![](https://ps.w.org/post-grid/assets/icon-256x256.gif?rev=3295086)
 * [Post Grid](https://wordpress.org/plugins/post-grid/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/post-grid/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/post-grid/)
 * [Active Topics](https://wordpress.org/support/plugin/post-grid/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/post-grid/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/post-grid/reviews/)

 * 4 replies
 * 3 participants
 * Last reply from: [Gabor](https://wordpress.org/support/users/nextendweb_gabor/)
 * Last activity: [3 years, 6 months ago](https://wordpress.org/support/topic/output-buffer-error-2/#post-16261315)
 * Status: resolved