{"id":12253340,"date":"2019-12-19T08:37:04","date_gmt":"2019-12-19T08:37:04","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/output-buffer-issue\/"},"modified":"2019-12-19T08:37:04","modified_gmt":"2019-12-19T08:37:04","slug":"output-buffer-issue","status":"publish","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/output-buffer-issue\/","title":{"rendered":"Output buffer issue"},"content":{"rendered":"<p>Hi @calinvingan,<br \/>\nI&#8217;m the developer of Smart Slider 3 and one of our customer informed us about a conflict between your plugin + WPRocket + Smart Slider. We do use output buffer too and in the past I gained a lot of experience in this topic. I checked your code and made a fix which should work in every case. \ud83d\ude42<\/p>\n<p>Edit the class <code>SQ_Models_Frontend<\/code><\/p>\n<p>Remove: <code>private $_buffer = false;<\/code><\/p>\n<p>Replace <code>getBuffer<\/code> method with:<\/p>\n<pre><code>\/**\n * Get the loaded buffer and change it\n *\n * @param string $buffer\n * @param int  $phase\n * @return string\n *\/\npublic function getBuffer($buffer, $phase) {\n\n\tif ($phase &amp; PHP_OUTPUT_HANDLER_FINAL || $phase &amp; PHP_OUTPUT_HANDLER_END) {\n\t\treturn apply_filters(&#039;sq_buffer&#039;, $buffer);\n\t}\n\n\treturn $buffer;\n}<\/code><\/pre>\n<p>The key is to use the $phase variable. Probably you have those &#8220;tricks&#8221; in the original source to run it only once.<\/p>\n","protected":false},"template":"","class_list":["post-12253340","topic","type-topic","status-publish","hentry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/12253340","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/12253340\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=12253340"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}