{"id":13887,"date":"2025-11-22T10:45:38","date_gmt":"2025-11-22T10:45:38","guid":{"rendered":"https:\/\/how.congdongso.net\/?p=13887"},"modified":"2025-11-22T10:45:38","modified_gmt":"2025-11-22T10:45:38","slug":"sua-loi-failed-to-send-buffer-of-zlib-output-compression-tren-wordpress","status":"publish","type":"post","link":"https:\/\/how.congdongso.net\/en\/fix-failed-to-send-buffer-of-zlib-output-compression-on-wordpress\/","title":{"rendered":"Fix Failed to send buffer of zlib output compression error on wordpress"},"content":{"rendered":"<p>The error \u201cFailed to send buffer of zlib output compression\u201d usually occurs when the web server cannot send compressed data to the browser. Here are some causes and solutions. This error appears on the latest wordpress version. Some websites, even without any plugins installed, still have this error. Here are 3 ways to fix it <a href=\"https:\/\/how.congdongso.net\/failed-to-send-buffer-of-zlib-output-compression\/\">Failed to send buffer of zlib output compression<\/a> For your reference and follow.<\/p>\n<h2>Cause of error Failed to send buffer of zlib output compression<\/h2>\n<ol>\n<li><strong>Server configuration<\/strong>: Check the server configuration (such as Apache or Nginx) to ensure that zlib compression is enabled and configured properly. You can find compression related settings in the configuration file.<\/li>\n<li><strong>Conflicts with plugins<\/strong>: If you are using a content management system like WordPress, there may be conflicts between plugins. Try disabling plugins temporarily to determine if any plugin is causing the problem.<\/li>\n<li><strong>Memory full<\/strong>: Make sure your server is not running out of memory or disk space, as this may prevent the server from being able to perform compression and send data.<\/li>\n<li><strong>Increase cache size<\/strong>: If you have access to PHP configuration, try increasing cache size by adjusting parameters like\u00a0<code>output_buffering<\/code>.<\/li>\n<li><strong>Check for PHP errors<\/strong>: Check the PHP error log to see if there are any error messages related to this issue.<\/li>\n<\/ol>\n<h2>How to handle failed to send buffer of zlib output compression error<\/h2>\n<p>Here are the solutions I found to share with you:<\/p>\n<p><strong><span style=\"text-decoration: underline;\">SOLUTION 1:<\/span><\/strong><\/p>\n<p>In plugins (or somewhere) you can have this code:<\/p>\n<pre>ini_set(&#039;zlib.output_compression&#039;, &#039;1&#039;);<\/pre>\n<p>so, i replaced that code with<\/p>\n<pre>if (!is_admin()) ob_start(&#039;ob_gzhandler&#039;); \/\/because, in admin pages, it causes plugin installation to freeze<\/pre>\n<p>and Compression will remain ON.<\/p>\n<p><span style=\"text-decoration: underline;\"><strong>SOLUTION 2:<\/strong><\/span><\/p>\n<p>You may have to use:<\/p>\n<pre>remove_action( &#039;shutdown&#039;, &#039;wp_ob_end_flush_all&#039;, 1 );<\/pre>\n<p><span style=\"text-decoration: underline;\"><strong>SOLUTION 3:<\/strong><\/span><\/p>\n<pre>\/** * The ob_end_flush() function is suitable for all levels * * This function replaces the WordPress * `wp_ob_end_flush_all()` function with an alternative function that does not cause a PHP message. *\/ remove_action( &#039;shutdown&#039;, &#039;wp_ob_end_flush_all&#039;, 1 ); add_action( &#039;shutdown&#039;, function() { while ( @ob_end_flush() ); } );<\/pre>\n<p>Below are detailed instructions for inserting the code you provide into your WordPress website:<\/p>\n<h3>How to insert code into WordPress<\/h3>\n<h4>1.\u00a0<strong>Use the Code Snippets plugin<\/strong><\/h4>\n<p>The simplest way to add code to WordPress without editing theme files is to use the \u201cCode Snippets\u201d plugin.<\/p>\n<ul>\n<li><strong>Step 1<\/strong>: Install the \u201cCode Snippets\u201d plugin.\n<ul>\n<li>Go to the WordPress dashboard, select \u201cPlugins\u201d &gt; \u201cAdd New\u201d.<\/li>\n<li>Search for \u201cCode Snippets\u201d and install.<\/li>\n<\/ul>\n<\/li>\n<li><strong>Step 2<\/strong>: Add new code.\n<ul>\n<li>After installation, go to \u201cSnippets\u201d &gt; \u201cAdd New\u201d.<\/li>\n<li>Give the snippet a name (e.g. \u201cCompress output\u201d).<\/li>\n<li>Paste the following code into the content box:<\/li>\n<\/ul>\n<\/li>\n<li><strong>\/\/ Solution 1<\/strong><\/li>\n<\/ul>\n<pre>if (!is_admin()) ob_start(&#039;ob_gzhandler&#039;); \/\/ Enable compression only on the frontend<\/pre>\n<ul>\n<li><strong>\/\/ Solution 2<\/strong><\/li>\n<\/ul>\n<pre>remove_action(&#039;shutdown&#039;, &#039;wp_ob_end_flush_all&#039;, 1);<\/pre>\n<ul>\n<li><strong>\/\/Solution 3<\/strong><\/li>\n<\/ul>\n<pre><span class=\"hljs-title function_ invoke__\">remove_action<\/span>(<span class=\"hljs-string\">&#039;shutdown&#039;<\/span>, <span class=\"hljs-string\">&#039;wp_ob_end_flush_all&#039;<\/span>, <span class=\"hljs-number\">1<\/span>);\r\n<span class=\"hljs-title function_ invoke__\">add_action<\/span>(<span class=\"hljs-string\">&#039;shutdown&#039;<\/span>, function() { while (@ob_end_flush()); });<\/pre>\n<ul>\n<li><strong>Step 3<\/strong>: Save and activate the snippet.\n<ul>\n<li>Click \u201cSave Changes and Activate\u201d to save and activate the code.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h4>2.\u00a0<strong>Edit the theme&#039;s functions.php file<\/strong><\/h4>\n<p>If you don&#039;t want to use a plugin, you can also insert the code into the file\u00a0<code>functions.php<\/code>\u00a0of the theme in use.<\/p>\n<ul>\n<li><strong>Step 1<\/strong>: Access the control panel.<\/li>\n<li><strong>Step 2<\/strong>: Go to \u201cAppearance\u201d &gt; \u201cTheme Editor\u201d.<\/li>\n<li><strong>Step 3<\/strong>: Select file\u00a0<code>functions.php<\/code>\u00a0from the list on the right.<\/li>\n<li><strong>Step 4<\/strong>: Paste the code at the end of the file (before tag\u00a0<code>?&gt;<\/code>\u00a0if any):<br \/>\n<strong>\/\/ Solution 1<\/strong><\/p>\n<pre>if (!is_admin()) ob_start(&#039;ob_gzhandler&#039;); \/\/ Enable compression only on the frontend<\/pre>\n<p><strong>\/\/ Solution 2<\/strong><\/p>\n<pre>remove_action(&#039;shutdown&#039;, &#039;wp_ob_end_flush_all&#039;, 1);<\/pre>\n<p><strong>\/\/Solution 3<\/strong><\/p>\n<pre><span class=\"hljs-title function_ invoke__\">remove_action<\/span>(<span class=\"hljs-string\">&#039;shutdown&#039;<\/span>, <span class=\"hljs-string\">&#039;wp_ob_end_flush_all&#039;<\/span>, <span class=\"hljs-number\">1<\/span>);\r\n<span class=\"hljs-title function_ invoke__\">add_action<\/span>(<span class=\"hljs-string\">&#039;shutdown&#039;<\/span>, function() { while (@ob_end_flush()); });<\/pre>\n<\/li>\n<li><strong>Step 5<\/strong>: Click \u201cUpdate file\u201d to save changes.<\/li>\n<\/ul>\n<h3>Note<\/h3>\n<ul>\n<li>Before making any changes, back up your website to avoid data loss.<\/li>\n<li>After inserting the code, test your website to make sure everything is working properly.<\/li>\n<\/ul>\n<h2>Conclude.<\/h2>\n<p>It is inevitable that users using WordPress will encounter errors. This article helps you handle the Failed to send buffer of zlib output compression error on WordPress. Hope it will be of great help to you. During the process, if you can&#039;t do it, please leave a comment below.<\/p>\n<p>Also you can visit <a href=\"https:\/\/www.facebook.com\/howto.edu.vn\" target=\"_blank\" rel=\"noopener\">Facebook fanpage of howto.edu.vn<\/a> us to update the latest information<\/p>","protected":false},"excerpt":{"rendered":"<p>L\u1ed7i &#8220;Failed to send buffer of zlib output compression&#8221; th\u01b0\u1eddng x\u1ea3y ra khi m\u00e1y ch\u1ee7 web kh\u00f4ng th\u1ec3 g\u1eedi d\u1eef li\u1ec7u n\u00e9n \u0111\u1ebfn tr\u00ecnh duy\u1ec7t. \u0110\u00e2y l\u00e0 m\u1ed9t s\u1ed1 nguy\u00ean nh\u00e2n v\u00e0 c\u00e1ch kh\u1eafc ph\u1ee5c. L\u1ed7i n\u00e0y xu\u1ea5t hi\u1ec7n tr\u00ean phi\u00ean b\u1ea3n wordpress m\u1edbi nh\u1ea5t. 1 s\u1ed1 trang web k\u1ec3 c\u1ea3 ch\u01b0a c\u00e0i b\u1ea5t c\u1ee9 &hellip;<\/p>","protected":false},"author":8,"featured_media":18436,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[34],"tags":[1167,564],"class_list":["post-13887","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-wordpress","tag-sua-loi-wordpress","tag-wordpress"],"_links":{"self":[{"href":"https:\/\/how.congdongso.net\/en\/wp-json\/wp\/v2\/posts\/13887","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/how.congdongso.net\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/how.congdongso.net\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/how.congdongso.net\/en\/wp-json\/wp\/v2\/users\/8"}],"replies":[{"embeddable":true,"href":"https:\/\/how.congdongso.net\/en\/wp-json\/wp\/v2\/comments?post=13887"}],"version-history":[{"count":1,"href":"https:\/\/how.congdongso.net\/en\/wp-json\/wp\/v2\/posts\/13887\/revisions"}],"predecessor-version":[{"id":21213,"href":"https:\/\/how.congdongso.net\/en\/wp-json\/wp\/v2\/posts\/13887\/revisions\/21213"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/how.congdongso.net\/en\/wp-json\/wp\/v2\/media\/18436"}],"wp:attachment":[{"href":"https:\/\/how.congdongso.net\/en\/wp-json\/wp\/v2\/media?parent=13887"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/how.congdongso.net\/en\/wp-json\/wp\/v2\/categories?post=13887"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/how.congdongso.net\/en\/wp-json\/wp\/v2\/tags?post=13887"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}