Multiple textdomains

You can call load_plugin_textdomain() multiple times in each plugin, but I would not do that.

Put the common files into a separate plugin, for example luke-carbis-library. In that plugin create two simple functions for setup and loading extra files:

add_action( 'plugins_loaded', 'lcl_init' );

function lcl_init()
{
    $dir = plugin_dir_path( __FILE__ );
    $url = plugins_url( __FILE__ );

    // maybe load necessary files and translation

    do_action( 'lcl_init', $dir, $url );
}

function lcl_load( $file )
{
    require_once plugin_dir_path( __FILE__ ) . $file;
}

In your depending plugins hook into your custom action:

add_action( 'lcl_init', 'depending_plugin_init', 10, 2 );

Now you can change the inner structure of the base plugin any time; the other plugins just use $dir and $url from your hook.

Leave a Comment