[ad_1]
Take a look at this ticket on core trac: https://core.trac.projectdmc.org/ticket/62337
Hello ,
In WordPress 6.7, changes in translation handling emphasize loading translations from the centralized wp-content/languages/themes/
directory. While not a bug, it’s a shift in behavior intended to standardize where WordPress looks for translations, moving towards using a dedicated languages directory rather than loading from within theme folders.Best Practices for Theme Translations in WP 6.7 and Beyond
- Primary Translation Location: Place translations in
wp-content/languages/themes/
with the filename convention{theme-slug}-{locale}.mo
(e.g.,your-theme-fr_FR.mo
). WordPress will prioritize this directory, allowing you to load translations without custom code. - Using
load_theme_textdomain
in Your Theme:- You can still call
load_theme_textdomain
, but specify thewp-content/languages/themes/
directory if you want to explicitly control where WordPress loads translations from:
- You can still call
load_theme_textdomain( 'your-theme', WP_LANG_DIR . '/themes' );
3. Fallback with load_textdomain
(for Development or Custom Scenarios):
- If you prefer to keep translations within your theme folder for development, you can continue using
load_textdomain
as a fallback. Just be aware this may not align with WordPress’s intended file structure for production environments. - Example:
load_textdomain( 'your-theme', get_template_directory() . '/languages/your-theme-fr_FR.mo' );
Thank you both for your answers!
All the best
Christian