• I want to keep WP_DEBUG enabled, but I don’t want Loco Translate to show debug output.
    However, using add_filter(‘loco_debug’,’__return_false’); doesn’t seem to work as expected

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author Tim W

    (@timwhitlock)

    The filter works if it’s registered in time.

    What debug output is showing after you’ve registered this filter?

    Thread Starter zecompadre

    (@zecompadre)

    if WP_DEBUG enabled the filter dont work WP_DEBUG  overrides …

    Plugin Author Tim W

    (@timwhitlock)

    What debug output is showing after you’ve registered this filter?

    Plugin Author Tim W

    (@timwhitlock)

    All output that checks loco_debugging() will override WP_DEBUG if the last registered filter returns false. If it’s not working then either (1) the output is not from my plugin, or (2) the filter is not registered in time, or (3) another filter is overriding. Please show me the output so we can eliminate no.1.

    Thread Starter zecompadre

    (@zecompadre)

    [Loco.debug] "Unloaded 1 premature text domain (favorites)" in src/hooks/LoadHelper.php:65
    Thread Starter zecompadre

    (@zecompadre)

            add_filter('loco_debug', function ($debug) { return false; }, 10, 1);
    • This reply was modified 1 year, 1 month ago by zecompadre.
    Plugin Author Tim W

    (@timwhitlock)

    That message does check loco_debugging(). See code. WP_DEBUG cannot logically override if the last filter to run returns false.

    This early domain loading check has to run as soon as physically possible, so – Most likely scenario is that your hook is not registered in time. Please show your filter code and where you’ve placed it.

    Thread Starter zecompadre

    (@zecompadre)

    not even if i put on my theme’s functions.php

    add_filter(‘loco_debug’, ‘__return_false’);

    keeps loging

    [18-Apr-2025 12:25:51 UTC] [Loco.debug] "Unloaded 1 premature text domain (favorites)" in src/hooks/LoadHelper.php:65
    [18-Apr-2025 12:25:51 UTC] [Loco.debug] "Unloaded 1 premature text domain (favorites)" in src/hooks/LoadHelper.php:65
    [18-Apr-2025 12:25:52 UTC] [Loco.debug] "Unloaded 1 premature text domain (favorites)" in src/hooks/LoadHelper.php:65
    [18-Apr-2025 12:25:52 UTC] [Loco.debug] "Unloaded 1 premature text domain (favorites)" in src/hooks/LoadHelper.php:65
    [18-Apr-2025 12:25:52 UTC] [Loco.debug] "Unloaded 1 premature text domain (favorites)" in src/hooks/LoadHelper.php:65
    [18-Apr-2025 12:25:52 UTC] [Loco.debug] "Unloaded 1 premature text domain (favorites)" in src/hooks/LoadHelper.php:65
    [18-Apr-2025 12:25:52 UTC] [Loco.debug] "Unloaded 1 premature text domain (favorites)" in src/hooks/LoadHelper.php:65
    [18-Apr-2025 12:25:52 UTC] [Loco.debug] "Unloaded 1 premature text domain (favorites)" in src/hooks/LoadHelper.php:65
    [18-Apr-2025 12:25:52 UTC] [Loco.debug] "Unloaded 1 premature text domain (favorites)" in src/hooks/LoadHelper.php:65

    • This reply was modified 1 year, 1 month ago by zecompadre.
    Plugin Author Tim W

    (@timwhitlock)

    functions.php is included AFTER all plugins have started up, so your filter won’t be registered when Loco Translate file loading helper starts up.

    Your only options are:
    1. Register your hook earlier. This will have to be in a Must-use plugin, or a regular plugin that runs before Loco Translate does.
    2. Fix the underlying problem you’re being warned about. (Favourites domain loading prematurely).
    3. Disable debug mode completely.

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

The topic ‘how to disable loco_debug’ is closed to new replies.