how to disable loco_debug
-
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
-
The filter works if it’s registered in time.
What debug output is showing after you’ve registered this filter?
if WP_DEBUG enabled the filter dont work WP_DEBUG overrides …
What debug output is showing after you’ve registered this filter?
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.
[Loco.debug] "Unloaded 1 premature text domain (favorites)" in src/hooks/LoadHelper.php:65add_filter('loco_debug', function ($debug) { return false; }, 10, 1);-
This reply was modified 1 year, 1 month ago by
zecompadre.
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.
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.
functions.phpis 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. -
This reply was modified 1 year, 1 month ago by
The topic ‘how to disable loco_debug’ is closed to new replies.