Note: Revised because that '__FILE__'
as in dirname(plugin_basename('__FILE__'))
, was just a typo in the post/question.
But one thing you did not include in your post, is about how are you loading the Bootstrapping
class, and where is the file located? Is it in a subfolder like includes
, i.e.
your-plugin/
includes/
class-bootstraping.php
languages/
your-plugin.pot
your-plugin.php (main plugin file)
If so, then you should not use __FILE__
and instead, in the main plugin file, you can define a constant which stores the full absolute path to the main plugin file. E.g.
define( 'YOUR_PLUGIN_FILE', __FILE__ );
// I commented it out, but this is how I loaded the class:
//require_once __DIR__ . '/includes/class-bootstraping.php';
Then from within your class, when you call plugin_basename()
, pass the above constant. E.g.
load_plugin_textdomain(
'language-domain',
false,
dirname( plugin_basename( YOUR_PLUGIN_FILE ) ) . '/languages'
);