I have a child theme which is not localized. So I added this in function.php

add_action( 'after_setup_theme', 'my_child_theme_setup' );
function my_child_theme_setup() {
    load_child_theme_textdomain( 'mytheme', get_stylesheet_directory() . '/languages' );

It doesn't work. I searched for hours and I read somebody advised putting this to the top of header.php

load_child_theme_textdomain( 'mytheme', get_stylesheet_directory() . '/languages' );

Suddenly it started working.

The problem is solved but I'm still curious why the legal way didn't work. Any of you have an explanation?

  • I'm also confused about this action. In the child theme, do you then use the parent theme's text domain for l18n?
    – Jay
    Sep 11, 2020 at 23:38
  • @Jay yes. You have to use main theme.
    – borayeris
    Sep 13, 2020 at 13:53

1 Answer 1


First of all, mind your language please. If there are swear words in your code, please remove it before you post your code.

OK, to get to your question, there is nothing wrong with your code. It looks sound. Which parent theme are you using?

I have a child theme which is not localized

You should have a look at how your strings are localized. You should also have to look at your naming of your language files. Go and have a look at the codex. Always remember, use the codex as reference. You can also go and have a look at this tutorial to get some insight.

Apart from that you should be good to go


I would like to keep the first part of this answer as reference for others. Your question had me puzzled, and then it hit me like lightning, I also missed the most obvious mistake, your template is named wrongly.

There is a huge difference between function.php and functions.php. Wordpress automatically knows and uses functions.php as the main functions template in a theme. This template need not be called. On the other hand, function.php is just a template with no hierarchy. This template must be called in some way in your theme so that wordpress will know when and how to use that template.

So, on your question, just rename your function.php to functions.php

  • Sorry for swear in the code. And you are right about function.php and functions.php
    – borayeris
    Apr 10, 2014 at 19:08

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.