Created
September 20, 2016 08:58
-
-
Save imath/46303100666f7243c30c67d8ac18ed6d to your computer and use it in GitHub Desktop.
Put this in any random file inside wp-content/mu-plugins to fix all custom language packs for plugins. Make sure the corresponding custom language packs are in WP_LANG_DIR/pluginName/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Exit if accessed directly | |
defined( 'ABSPATH' ) || exit; | |
function fix_all_custom_language_packs_load_textdomain_mofile( $mofile, $domain ) { | |
if ( WP_LANG_DIR . '/plugins' === dirname( $mofile ) ) { | |
$mo = basename( $mofile ); | |
$alt = trailingslashit( WP_LANG_DIR ) . $domain . '/'; | |
if ( file_exists( $alt . $mo ) ) { | |
return $alt . $mo; | |
} | |
} | |
return $mofile; | |
} | |
add_filter( 'load_textdomain_mofile', 'fix_all_custom_language_packs_load_textdomain_mofile', 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment