Fixes _doing_it_wrong()
messages being displayed on WordPress 6.7 due to translating too early
#3616
+35
−10
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 #3604
Related P2: peNR48-111-p2
Changes proposed in this Pull Request:
After updating to WordPress 6.7, stores using our Stripe extension and have
WP_Debug
enabled will start seeing the following_doing_it_wrong
notices across WP Admin pages:In WordPress 6.7, they changed the way translations are loaded which affects how and when translation strings should be triggered. With this change, any
__()
code called before theafter_setup_theme
is considered "too early" and will need to be updated to happen on a later hook.Part of the challenge with Stripe is that the entire plugin is inited on the
'plugins_loaded'
hook (which is beforeafter_setup_theme
):Digging through all of the files and classes included/initiated
WC_Stripe->init()
I found the following issues within Stripe:WC_Stripe_Privacy
translated strings in the__construct()
. Fixed in a4b1be2WC_Stripe_Settings_Controller
was being instantiated with passingget_main_stripe_gateway()
as the second parameter. This function builds the main Stripe gateway class which translates a bunch of strings. 5b88b55load_plugin_textdomain()
was being called onplugins_loaded
, this should happen on init 0361256Testing instructions
To confirm the bug:
define( 'WP_DEBUG', true );
is set in wp-configThere are two key areas of Stripe that these changes impact:
1. Privacy erasers/exporters
2. Settings Controller
changelog.txt
andreadme.txt
(or does not apply)Post merge