• Resolved fabeluna

    (@fabeluna)


    There is some issue with the ACF Pro Plugin. If I create a new Block Template with ACF Pro, some of the output will fire multiple times.

    For example:
    If I’m using an add_action hook, this hook fires 25 times.
    This occures only if Qui Blocks plugin is activated, too.
    Could you have a look at this?

    Thanks,
    Leni

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Qode

    (@qodeinteractive)

    Hi there,

    Thanks for writing in!

    Could you please tell us which hook you are using exactly as well as provide us a video or a screenshot of the issue so we can try to reproduce this on our side as well. So as much information possible would be helpful.

    Thank you

    Best,
    Qode

    Thread Starter fabeluna

    (@fabeluna)

    Hello,
    thank you very much for the reply, I’m using the wp_head hook.
    See Screenshots:
    https://drive.filen.io/f/f35d4f77-38e2-4f1e-9976-a3deafb0ff02#ZKQ0CPCpSP0kub1ohqLldjyRnxrPhcm9).

    Thanks,
    Leni

    Plugin Author Qode

    (@qodeinteractive)

    Thank you for providing us with the info.

    Our dev team managed to reproduce this on our local installation and the fix should be included in the next update.

    Best,
    Qode

    Thread Starter fabeluna

    (@fabeluna)

    Hello,
    thank you very much for the Update. It’s much better now, but the hook is still firing twice. Could you check it again?
    Thanks,
    Leni

    Plugin Author Qode

    (@qodeinteractive)

    Hi,

    Due to the way functions are set up, if the wp_head hook is used, it will fire twice.

    Best,
    Qode

    Thread Starter fabeluna

    (@fabeluna)

    Hello,
    thank you for the answer. If the Qi Blocks Plugin is deactivated, is fires ones, if it is activated, it fires twice..

    Plugin Author Qode

    (@qodeinteractive)

    Hi,

    This occurs due to the default WordPress function we use to get the whole HTML content of the page to check if the there are Qi Blocks on the page. This is done for performance reasons, this function checks if there are Qi Blocks on the page and then loads scripts only if there are any.
    This default WordPress function calls for wp_head hook and this is why it is being called twice, first initially and the second time by our function. We are still investigating on how to get this to be called just once, however, for now it will be called twice.

    In your case you can use the code below:

    $cssContent = ‘*{color: red;}’;

    add_action( ‘wp_enqueue_scripts’, function () use ( $cssContent ) {
    wp_add_inline_style( ‘global-styles’, $cssContent );
    } );

    This should resolve it in your case.

    Best,
    Qode

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘ACF Pro Conflict’ is closed to new replies.