I am trying to internationalize the plugin I am creating but it doesn't seem to display the translated texts that are translated in the .po file.

Firstly, I have referred to the following sources: https://developer.wordpress.org/plugins/internationalization/how-to-internationalize-your-plugin/ https://www.sitepoint.com/wordpress-i18n-make-your-plugin-translation-ready/ https://premium.wpmudev.org/blog/ultimate-guide-wordpress-localization/#plugins

Here is my current directory like:


Initially, my text domain was not the plugin slug (is it not possible to use a different text domain?) so I had to change it as per the second link I have posted, it mentioned:

The text domain must match the slug of the plugin. For example, if your plugin is a single file called sample-plugin.php or it is contained in a folder called sample-plugin the text domain should be sample-plugin.

So in my php files I have something like __('Read More', my-custom-dragon-plugin)

In my my-custom-dragon-plugin.php, I have the plugin definition and the function that loads the text domain:

    Plugin Name: My Custom Dragon
    Plugin URI: https://www.xxxxxx.de/
    Description: This is a plugin customized for my dragons.
    Author: Jedragon
    Text Domain: my-custom-dragon-plugin
    Domain Path: /languages/
    Version: 0.1.0

add_action( 'plugins_loaded', 'load_my_textdomain' );

function load_my_textdomain() {

    $domain = 'my-custom-dragon-plugin';
     load_plugin_textdomain( $domain, false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );


I am also using POEdit for my .po files.

When I try to check if the changes are reflected, the text still remains in English even if I change the site language.

Is there anything that I have missed or I am doing incorrectly?

Thanks in advance.

  • 1
    In your code, do you have __('Read More', my-custom-dragon-plugin) or do you have __('Read More', 'my-custom-dragon-plugin')?
    – Mat
    Commented Apr 15, 2018 at 12:34
  • Hi Mat, I was just literally going to post that too. I missed the ''. Is there any way that I can use a different text domain though? Commented Apr 15, 2018 at 12:37

1 Answer 1


I just found it, it's because I missed placing the text domain in '' in my php code.

It should be

__('Read More', 'my-custom-dragon-plugin');

instead of

__('Read More', my-custom-dragon-plugin);

Now my translation is working. I am just wondering now if it is possible to use a custom text domain instead of my long plugin slug.

I was able to figure it out before I saw @mat 's answer. I upvoted your comment though @mat.

  • 1
    Give credit where credit is due... ;-) As far as I know, you should be able to use any text domain string that you like... Try it...
    – Mat
    Commented Apr 15, 2018 at 12:43
  • Crediting you by upvoting your comment though I saw it after I found the issue. Thanks again! Commented Apr 15, 2018 at 12:50
  • 1
    It's technically possible to use any text domain you like, or even multiple text domains, but there are downsides to ignoring WordPress standards. (1) The Glotpress community will not translate your plugin for you (2) You run a [small] risk of conflicting with some other plugin. (3) You can't take advantage of WordPress's "just in time" translation loading.
    – Tim
    Commented Apr 27, 2018 at 10:13

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.