Skip to content

Instantly share code, notes, and snippets.

@loorlab
Last active March 30, 2021 12:35
Show Gist options
  • Select an option

  • Save loorlab/028d9fca02e6e4f85d1a to your computer and use it in GitHub Desktop.

Select an option

Save loorlab/028d9fca02e6e4f85d1a to your computer and use it in GitHub Desktop.

Revisions

  1. loorlab revised this gist Dec 12, 2019. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion disable_zlib.output_compression
    Original file line number Diff line number Diff line change
    @@ -17,7 +17,7 @@ You may have to use:

    remove_action( 'shutdown', 'wp_ob_end_flush_all', 1 );

    ======================== SOLUTION 3 ====================
    ======================== SOLUTION 3 via @Kevinlearynet ====================
    /**
    * Proper ob_end_flush() for all levels
    *
  2. loorlab revised this gist Dec 12, 2019. 1 changed file with 12 additions and 0 deletions.
    12 changes: 12 additions & 0 deletions disable_zlib.output_compression
    Original file line number Diff line number Diff line change
    @@ -16,3 +16,15 @@ and Compression will be remained still ON.
    You may have to use:

    remove_action( 'shutdown', 'wp_ob_end_flush_all', 1 );

    ======================== SOLUTION 3 ====================
    /**
    * Proper ob_end_flush() for all levels
    *
    * This replaces the WordPress `wp_ob_end_flush_all()` function
    * with a replacement that doesn't cause PHP notices.
    */
    remove_action( 'shutdown', 'wp_ob_end_flush_all', 1 );
    add_action( 'shutdown', function() {
    while ( @ob_end_flush() );
    } );
  3. loorlab revised this gist Jul 29, 2015. No changes.
  4. loorlab created this gist Jul 29, 2015.
    18 changes: 18 additions & 0 deletions disable_zlib.output_compression
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,18 @@
    SOLUTIONS I have came across so far:

    ======================== SOLUTION 1 ====================

    In plugins (or somewhere) you probably have this code:

    ini_set('zlib.output_compression', '1');

    so, I replaced that code with

    if (!is_admin()) ob_start('ob_gzhandler'); //because, in admin pages, it causes plugin installation freezing

    and Compression will be remained still ON.

    ======================== SOLUTION 2 ====================
    You may have to use:

    remove_action( 'shutdown', 'wp_ob_end_flush_all', 1 );