0

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' );
5
  • 1
    Where did you keep the mo file? Commented May 7, 2019 at 7:37
  • the mo file is in language folder Commented May 7, 2019 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
    Commented May 7, 2019 at 8:13
  • it's use standalone Commented May 7, 2019 at 8:40
  • the name of translation file is fa_IR Commented May 7, 2019 at 8:42

1 Answer 1

0

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 and acknowledge you have read our privacy policy.

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