output buffer error
-
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.
- The topic ‘output buffer error’ is closed to new replies.