Hi Marko and all!!!

I have an issue with this PHP code that seems to be completely ignored in SCORG, but working fine in functions.php or any other code snippet plugin:


function callback($buffer) {
    return 'EMPTY';

function buffer_start() { ob_start("callback"); }
function buffer_end() { ob_end_flush(); }

add_action('wp_loaded', 'buffer_start');
add_action('shutdown', 'buffer_end');

(setting in SCORG is Condition: PHP)

Do you have any idea why this specific code woudn’t work?
(it is used to alter WordPress HTML post output, so maybe a conflict with buffering stuff…)
Thanks in advance,

2 responses to “This code block seems to be ignored”

  1. cmsexpertss says:

    Hi Yan,

    Thank you for contacting us.

    I checked your code, basically we are using some hooks which are needed to get current pages/post in order to apply the conditions, so the hook you were trying to use was getting called before our hooks. So we had two options:

    – Either set it to run “everywhere” and add a !is_admin() condition
    – Or wrap the code in “init” action

    I used the later one, you can check the code its working fine.

    Muhammad Osama

  2. yankiara says:

    Hi Muhammad,
    And thanks for your lightning fast answer 🙂

    I could make it work with your first solution, thank you so much!!!

    However, it doesn’t seem work with the ‘init’ hook option. Here’s what I’ve tried:

    add_action( ‘init’, function() {

    Thanks again!!!

Leave a Reply

Your email address will not be published.