Fix _load_textdomain_just_in_time warning #4151
Merged
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.
Fixes #4085, #4140
Changes proposed in this Pull Request:
This PR fixes a warning that occurs when translations are loaded too early in the WordPress lifecycle. The warning appears as:
The issue was introduced when the Status page updates were added in #3878, which instantiates the payment gateway during
plugins_loaded
. This caused translations to be loaded before WordPress's text domain infrastructure was fully initialized.Initially, I considered moving the entire plugin initialization from
plugins_loaded
toinit
. While that fixed the error and should avoid any future instances that could lead to similar errors, it would have been too broad of a change with potential side effects.Instead, this PR proposes a more targeted fix of only initializing the status page updates during
init
.This ensures:
Testing instructions
To reproduce the error:
define( 'WP_DEBUG', true );
to yourwp-config.php
English (UK)
via Settings -> General -> Site Language.Test the fix:
Test for regressions:
Follow the instructions in #3878
Changelog entry
Changelog Entry Comment
Comment
Post merge