How do I override a parent theme’s language files with a child theme?

I have a parent theme and a child theme, I would like to override the spanish .mo and .po files in the parent theme (or add them if they are not present in the parent theme) with the es_ES ones in my child theme. I added the folder with the modified mo and po files in the child theme with the same folder name as in the parent theme but this is not working. How can I come about this?
Thanks!

2 Answers
2

you may use this below code for your problem:

  [1]: https://i.stack.imgur.com/5aX1D.png

or use below code:

add_action( 'after_setup_theme', function () 
{

    load_theme_textdomain( 'your parent theme name', get_stylesheet_directory() . '/languages/' );

    load_child_theme_textdomain( 'your child theme name', get_stylesheet_directory() . '/languages' );
} );

Leave a Comment