Fix premature translation loading - #556
Open
gregorvolkmann wants to merge 1 commit into
Open
Conversation
Moved role definitions to init hook to prevent premature translation loading. Error/Notice: ( ! ) Notice: Function _load_textdomain_just_in_time was called <strong>incorrectly</strong>. Translation loading for the <code>eventorganiser</code> domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the <code>init</code> action or later. Please see <a href="https://developer.wordpress.org/advanced-administration/debug/debug-wordpress/">Debugging in WordPress</a> for more information. (This message was added in version 6.7.0.) in /srv/www/PROJECT/public_html/wp-includes/functions.php on line 6121 Call Stack # Time Memory Function Location 1 0.0031 468936 {main}( ) .../index.php:0 2 0.0033 469288 require( '/srv/www/PROJECT/public_html/wp-blog-header.php ) .../index.php:17 3 0.0034 469928 require_once( '/srv/www/PROJECT/public_html/wp-load.php ) .../wp-blog-header.php:13 4 0.0036 470528 require_once( '/srv/www/PROJECT/public_html/wp-config.php ) .../wp-load.php:50 5 0.0038 479512 require_once( '/srv/www/PROJECT/public_html/wp-settings.php ) .../wp-config.php:105 6 0.1278 2514792 include_once( '/srv/www/PROJECT/public_html/wp-content/plugins/event-organiser/event-organiser.php ) .../wp-settings.php:545 7 0.1278 2516120 __( $text = 'Edit Events', $domain = 'eventorganiser' ) .../event-organiser.php:122 8 0.1278 2516120 translate( $text = 'Edit Events', $domain = 'eventorganiser' ) .../l10n.php:307 9 0.1278 2516120 get_translations_for_domain( $domain = 'eventorganiser' ) .../l10n.php:195 10 0.1278 2516120 _load_textdomain_just_in_time( $domain = 'eventorganiser' ) .../l10n.php:1409 11 0.1353 2530424 _doing_it_wrong( $function_name = '_load_textdomain_just_in_time', $message = 'Translation loading for the <code>eventorganiser</code> domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the <code>init</code> action or later.', $version = '6.7.0' ) .../l10n.php:1371 12 0.1353 2531768 wp_trigger_error( $function_name = '', $message = 'Function _load_textdomain_just_in_time was called <strong>incorrectly</strong>. Translation loading for the <code>eventorganiser</code> domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the <code>init</code> action or later. Please see <a href="https://developer.wordpress.org/advanced-administration/debug/debug-wordpress/">Debugging in WordPress</a> for more information. (This message was added in version 6.7.0.)', $error_level = ??? ) .../functions.php:6061 13 0.1355 2532936 trigger_error( $message = 'Function _load_textdomain_just_in_time was called <strong>incorrectly</strong>. Translation loading for the <code>eventorganiser</code> domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the <code>init</code> action or later. Please see <a href="https://developer.wordpress.org/advanced-administration/debug/debug-wordpress/">Debugging in WordPress</a> for more information. (This message was added in version 6.7.0.)', $error_level = 1024 ) .../functions.php:6121
Contributor
|
Sadly, I don't think @stephenh1988 checks this repo any more. FWIW, I opened #553 for this. Ultimately, it looks like the string definitions should be moved to |
|
Also just flaging that i think you would need to also change L107 to be on the hook init as well |
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.
Moved role definitions to init hook to prevent premature translation loading.
Error/Notice:
( ! ) Notice:
Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the
eventorganiserdomain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at theinitaction or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /srv/www/PROJECT/public_html/wp-includes/functions.php on line 6121 Call Stack# Time Memory Function Location
1 0.0031 468936 {main}( ) .../index.php:0
2 0.0033 469288 require( '/srv/www/PROJECT/public_html/wp-blog-header.php ) .../index.php:17 3 0.0034 469928 require_once( '/srv/www/PROJECT/public_html/wp-load.php ) .../wp-blog-header.php:13 4 0.0036 470528 require_once( '/srv/www/PROJECT/public_html/wp-config.php ) .../wp-load.php:50 5 0.0038 479512 require_once( '/srv/www/PROJECT/public_html/wp-settings.php ) .../wp-config.php:105 6 0.1278 2514792 include_once( '/srv/www/PROJECT/public_html/wp-content/plugins/event-organiser/event-organiser.php ) .../wp-settings.php:545 7 0.1278 2516120 __( $text = 'Edit Events', $domain = 'eventorganiser' ) .../event-organiser.php:122 8 0.1278 2516120 translate( $text = 'Edit Events', $domain = 'eventorganiser' ) .../l10n.php:307 9 0.1278 2516120 get_translations_for_domain( $domain = 'eventorganiser' ) .../l10n.php:195 10 0.1278 2516120 _load_textdomain_just_in_time( $domain = 'eventorganiser' ) .../l10n.php:1409 11 0.1353 2530424 _doing_it_wrong( $function_name = '_load_textdomain_just_in_time', $message = 'Translation loading for the
eventorganiserdomain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at theinitaction or later.', $version = '6.7.0' ) .../l10n.php:1371 12 0.1353 2531768 wp_trigger_error( $function_name = '', $message = 'Function _load_textdomain_just_in_time was called incorrectly. Translation loading for theeventorganiserdomain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at theinitaction or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.)', $error_level = ??? ) .../functions.php:6061 13 0.1355 2532936 trigger_error( $message = 'Function _load_textdomain_just_in_time was called incorrectly. Translation loading for theeventorganiserdomain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at theinitaction or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.)', $error_level = 1024 ) .../functions.php:6121