Fix translation loading timing by moving from plugins_loaded to init hook#409
Draft
Fix translation loading timing by moving from plugins_loaded to init hook#409
Conversation
Co-authored-by: polevaultweb <1770201+polevaultweb@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Translation loading for the wp-user-manager domain was triggered too early.
Fix translation loading timing by moving from plugins_loaded to init hook
Jul 10, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The translation loading for the
wp-user-managerdomain was triggered too early, occurring on theplugins_loadedhook 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_loadedhook to theinithook, which is the recommended timing for translation loading in WordPress.Before:
After:
Changes Made
includes/class-wp-user-manager.phpline 449 to use theinithook instead ofplugins_loadedinithookVerification
plugins_loaded→init)load_plugin_textdomainis calledThis 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/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/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/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/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/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/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:
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.