• Resolved alexschoerg

    (@alexschoerg)


    Hi,

    your plugin prints its frontend script extremely late using:
    add_action('wp_footer', [$this, 'enqueueScriptsAsync'], PHP_INT_MAX); in WidgetLoader.php:36

    Because of the PHP_INT_MAX priority, no other plugin can reliably hook after it or modify the script tag. This causes integration issues with consent management plugins like Borlabs Cookie, which need to intercept or modify scripts before output.

    Please lower the priority to a reasonable value (e.g. default 10), so other plugins can interact properly.

    Thank you!

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Support olektidio

    (@olektidio)

    Hi,

    Thanks for reaching out.

    The PHP_INT_MAX priority is intentional. Our script is injected at the very end of the footer to avoid unintended interactions with other plugins and to ensure it does not impact the loading sequence of earlier assets. In practice, this has helped us prevent race conditions and conflicts in complex environments.

    That said, we definitely want to ensure compatibility with consent management tools.

    To better understand the issue, could you clarify:

    1. Are you attempting to modify the script via the script_loader_tag filter?
    2. Is the problem specifically with Borlabs Cookie, or does it affect other consent tools as well?
    3. Are you trying to block execution until consent is granted, or only to rewrite the <script> tag?
    4. Are you relying on WordPress’ script enqueue system, or expecting interception of a raw <script> tag?
    5. Would hooking earlier in wp_footer (e.g., priority 20 or 100) resolve your issue, or do you require full control over the tag output?

    Depending on the exact integration requirement, we may be able to expose a filter or adjust our loading strategy without compromising the stability guarantees we currently rely on.

    Looking forward to your clarification.

    Best regards,

      Ben

      (@benbornschein)

      Hi Olek,

      Thanks for responding.

      1. Are you attempting to modify the script via the script_loader_tag filter?
        No. We use a buffer to capture the website content so we can detect and block scripts that require consent. Depending on the WordPress version and the active theme, we either use our own buffering system or the one introduced with WordPress 6.9.
      2. Is the problem specifically with Borlabs Cookie, or does it affect other consent tools as well?
        This likely affects other consent tools and caching plugins too, since many of them rely on the wp_footer() hook.
      3. Are you trying to block execution until consent is granted, or only to rewrite the <script> tag?
        We need to rewrite the tag.
      4. Are you relying on WordPress’ script enqueue system, or expecting interception of a raw <script> tag?
        No. Your plugin is actually a good example of why relying on this method is not reliable.
      5. Would hooking earlier in wp_footer (e.g., priority 20 or 100) resolve your issue, or do you require full control over the tag output?
        If you could change it to 20 or 100, that would be great.

      Best regards,
      Ben from Borlabs

      Plugin Support olektidio

      (@olektidio)

      Hi Ben,

      Thanks for the detailed clarification.

      We’re planning to change the priority from PHP_INT_MAX to 1000 for consistency with our sync loading approach. Additionally, we’ll expose a filter so users can adjust the priority if needed:

      $priority = apply_filters(‘tidio_widget_footer_priority’, 1000);
      add_action(‘wp_footer’, [$this, ‘enqueueScriptsAsync’], $priority);

      This way, the default behavior becomes compatible with output buffering, while edge-case users can restore the old behavior if necessary.

      Does 1000 work for your buffering system, or would you recommend a lower value? Also, if there’s a priority range that consent/caching plugins typically hook at, we’d like to stay below that threshold.

      Looking forward to your feedback.

      Best regards,

      Ben

      (@benbornschein)

      Hi Olek,

      A priority of 1000 would make it work out of the box, and the extra filter is a nice way for other systems to tweak the priority for their own compatibility needs.

      There is no defined standard for priorities. I would recommend using the default priority of 10 for your script, as it does not rely on any third party JavaScript. I do not see a reason to change the priority in the first place.

      Thanks a lot for the quick fix!

      Best regads,
      Ben

      Plugin Support olektidio

      (@olektidio)

      Hi Ben,

      Just a quick update – the change has landed in version 7.0.0, which is available now.

      We’ve:

      – Replaced PHP_INT_MAX with a default priority of 1000
      – Added a tidio_widget_footer_priority filter so the priority can be customized if needed

      This should allow your buffering system (and other consent/caching tools) to properly intercept and rewrite the script.

      Please let us know if everything works as expected on your side.

      Best regards

      Ben

      (@benbornschein)

      Hi Olek,

      Thank you very much for your quick help in resolving this issue.

      Best regards,
      Ben

      Plugin Support olektidio

      (@olektidio)

      Hi Ben!

      Thanks for your response.

      Glad we could help! Do let us know if you have any other questions.

      PS.

      We would really appreciate it if you could rate our app or your experience with our Support Team. Here is a direct link: click here

      It should take you just a minute, but it really helps us in development! Thank you for your time.

    Viewing 7 replies - 1 through 7 (of 7 total)

    You must be logged in to reply to this topic.