Skip to content

Instantly share code, notes, and snippets.

@SleeplessByte
Last active December 10, 2015 22:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SleeplessByte/4501807 to your computer and use it in GitHub Desktop.
Save SleeplessByte/4501807 to your computer and use it in GitHub Desktop.
Loads the textdomain for a plugin.
<?php
/**
* Preferably the plugin is (in) a class, so use:
* add_action( array( &$this, 'textdomain_init');
*/
add_action( 'plugins_loaded', 'textdomain_init' );
/**
* Initializes the textdomain for this plugin
*/
function textdomain_init() {
$plugin_dir = basename( plugin_dir_url( __FILE__ ) );
load_plugin_textdomain( 'domain' , false , $plugin_dir . '/languages' );
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment