Fix translation loading timing by moving from plugins_loaded to init hook
Problem
The translation loading for the wp-user-manager domain was triggered too early, occurring on the plugins_loaded hook with priority 0. This is against WordPress best practices and can cause translation loading warnings in debug logs.
Solution
Moved the textdomain loading from the plugins_loaded hook to the init hook, which is the recommended timing for translation loading in WordPress.
Before:
add_action( 'plugins_loaded', array( $this, 'load_textdomain' ), 0 );
After:
add_action( 'init', array( $this, 'load_textdomain' ) );
Changes Made
- Modified
includes/class-wp-user-manager.phpline 449 to use theinithook instead ofplugins_loaded - Removed the priority parameter as it's not needed on the
inithook - Maintains proper execution order with the main plugin initialization
Verification
- ✅ Follows WordPress translation loading best practices
- ✅ No conflicts with existing translation usage in the codebase
- ✅ Proper hook execution order maintained (
plugins_loaded→init) - ✅ Syntax validation passed
- ✅ Only location where
load_plugin_textdomainis called
This change ensures translations are loaded at the appropriate time and eliminates the early loading warnings.
Fixes #405.
[!WARNING]
Firewall rules blocked me from connecting to one or more addresses
I tried to connect to the following addresses, but was blocked by firewall rules:
https://api.github.com/repos/Brain-WP/Cortex/zipball/dd6484cd8b049a141b5a73746857fa5415caaca4
- Triggering command:
/usr/bin/php8.3 -n -c /tmp/wTpKab /usr/bin/composer install --no-dev --optimize-autoloader(http block)https://api.github.com/repos/composer/installers/zipball/d20a64ed3c94748397ff5973488761b22f6d3f19
- Triggering command:
/usr/bin/php8.3 -n -c /tmp/wTpKab /usr/bin/composer install --no-dev --optimize-autoloader(http block)https://api.github.com/repos/nikic/FastRoute/zipball/8164b4a0d8afde4eae5f1bfc39084972ba23ad36
- Triggering command:
/usr/bin/php8.3 -n -c /tmp/wTpKab /usr/bin/composer install --no-dev --optimize-autoloader(http block)https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363
- Triggering command:
/usr/bin/php8.3 -n -c /tmp/wTpKab /usr/bin/composer install --no-dev --optimize-autoloader(http block)https://api.github.com/repos/sabberworm/PHP-CSS-Parser/zipball/e41d2140031d533348b2192a83f02d8dd8a71d30
- Triggering command:
/usr/bin/php8.3 -n -c /tmp/wTpKab /usr/bin/composer install --no-dev --optimize-autoloader(http block)https://api.github.com/repos/symfony/polyfill-mbstring/zipball/9344f9cb97f3b19424af1a21a3b0e75b0a7d8d7e
- Triggering command:
/usr/bin/php8.3 -n -c /tmp/wTpKab /usr/bin/composer install --no-dev --optimize-autoloader(http block)If you need me to access, download, or install something from one of these locations, you can either:
- Configure Actions setup steps to set up my environment, which run before the firewall is enabled
- Add the appropriate URLs or hosts to my firewall allow list
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.