Advertisement
arie_cristianD

ob_end_flush()

Jul 3rd, 2023
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.57 KB | None | 0 0
  1.  
  2. I wouldn't recommend disabling the wp_ob_end_flush_all() function entirely, and I definitely wouldn't turn off zlib.output_compression in your php.ini file. Here's a better approach that replaces the source code causing the issue, and preserves the underlying functionality:
  3.  
  4. /**
  5. * Proper ob_end_flush() for all levels
  6. *
  7. * This replaces the WordPress `wp_ob_end_flush_all()` function
  8. * with a replacement that doesn't cause PHP notices.
  9.  */
  10.  
  11. remove_action( 'shutdown', 'wp_ob_end_flush_all', 1 );
  12. add_action( 'shutdown', function() {
  13.    while ( @ob_end_flush() );
  14. } );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement