I'm trying to translate a WordPress template. I went to language files, then opened that copy with Poedit and started translating to my language (persian).

After finishing the translation, I changed the WordPress language from the dashboard, but the language didn't change in the template settings panel, it stays on English. Any idea why this happens?

These are the language instructions from functions.php:

load_theme_textdomain( 'apress', get_template_directory() . '/languages' );
  • 1
    Where did you keep the mo file? May 7 '19 at 7:37
  • the mo file is in language folder May 7 '19 at 7:56
  • 1. what is the name of your translation file. 2. Do you use load_theme_textdomain in any hook or standalone?
    – anton
    May 7 '19 at 8:13
  • it's use standalone May 7 '19 at 8:40
  • the name of translation file is fa_IR May 7 '19 at 8:42

According to docs, load_theme_textdomain() function should generally be called from within the after_setup_theme action hook.

add_action( 'after_setup_theme', 'my_theme_setup' );

function my_theme_setup(){
    load_theme_textdomain( 'apress', get_template_directory() . '/languages' );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.