Problem: A user using my plugin experienced the infamous 'White Screen of Death' (WSD) on their homepage, all other pages worked correctly.

Cause: My plugin implements a fix to the infamous WordPress error ob_end_flush(): failed to send buffer of zlib output compression (1) in ...\wp-includes\functions.php on line 4556, see here for more details and here for the solution I use. This code caused the users WSD. When I removed it, the problem stopped.

My Question: Why did the WSD occur just for this user when the majority of users who use my plugin don't experience this WSD error!? And why does the ob_end_flush() fix cause the WSD error for some users!?

User specifications that might be helpful:

  • User's server is nginx (not apache)
  • User has Bluehost as the server host. Interestingly Bluehost WordPress versions have a caching option native, its not a plugin. Its just an option in Settings->General and the user can select levels - Level 0-2 caching.
  • If I disabled all plugins on the users website except my plugin the error still occurred. If I then disabled my plugin, the error stopped so it was confirmed the issue was due to my plugin and specifically the code fix to WordPress's ob_end_flush() error.
  • User has WP 5.6.1, PHP 7.4.15 and theme Twenty Twenty.

My code that caused the WSD in that specific user (but it doesn't in other users):

add_action('init', function() {
  remove_action( 'shutdown', 'wp_ob_end_flush_all', 1 );
  add_action( 'shutdown', function() {
    while ( @ob_end_flush() );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.