Skip to content

Defer theme name translations to avoid early textdomain loading#625

Merged
akirk merged 1 commit intomainfrom
fix/early-textdomain-loading
Mar 27, 2026
Merged

Defer theme name translations to avoid early textdomain loading#625
akirk merged 1 commit intomainfrom
fix/early-textdomain-loading

Conversation

@akirk
Copy link
Copy Markdown
Owner

@akirk akirk commented Mar 27, 2026

Summary

  • Theme names were translated via __() during friends_load_themes at plugins_loaded, before translations are available
  • This triggered the _load_textdomain_just_in_time warning since WordPress 6.7
  • Each theme now registers its name as a plain string and hooks friends_theme_name to provide the translation at display time
  • External themes can use the same pattern: register with an untranslated name, add a friends_theme_name filter

Test plan

  • Verify no _load_textdomain_just_in_time notice for the friends domain
  • Verify theme names still display translated in the settings dropdown

Test in WordPress Playground

Theme names were translated via __() during registration at
plugins_loaded, before translations are available. This triggered
a _load_textdomain_just_in_time warning since WordPress 6.7.

Register theme names as plain strings and add a friends_theme_name
filter that each theme hooks to provide its translation at display
time. External themes can use the same pattern.
@akirk akirk force-pushed the fix/early-textdomain-loading branch from bb6c3bb to 9332599 Compare March 27, 2026 18:06
@akirk akirk merged commit 85007d7 into main Mar 27, 2026
25 checks passed
@akirk akirk deleted the fix/early-textdomain-loading branch March 27, 2026 18:07
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.

1 participant