Skip to content

Fix premature translation loading - #556

Open
gregorvolkmann wants to merge 1 commit into
stephenharris:developfrom
gregorvolkmann:patch-1
Open

Fix premature translation loading#556
gregorvolkmann wants to merge 1 commit into
stephenharris:developfrom
gregorvolkmann:patch-1

Conversation

@gregorvolkmann

@gregorvolkmann gregorvolkmann commented Dec 17, 2025

Copy link
Copy Markdown

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 eventorganiser 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 init action 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 eventorganiser 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 init 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 incorrectly. Translation loading for the eventorganiser 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 init action 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 the eventorganiser 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 init action 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

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
@christianwach

Copy link
Copy Markdown
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 eventorganiser_uninstall_site() which is the only place they're used.

@seamuslee001

Copy link
Copy Markdown

Also just flaging that i think you would need to also change L107 to be on the hook init as well

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants