Last active
July 8, 2022 13:04
-
-
Save nextab/b0c36d08bbc6dc1e65e5a54e6c28d6ea to your computer and use it in GitHub Desktop.
Divi & Polylang have a weird bug when you have both installed on the same website: no matter what your user account has selected as its preferred language, Divi's backend builder will always show the translation for the primary language set in Polylang.
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
| #region Set Divi's backend to English for Oli's user account | |
| add_filter( 'load_textdomain_mofile', 'switch_divi_to_en', 10, 2 ); | |
| /* | |
| * Replace 'textdomain' with your plugin's textdomain. e.g. 'hello-dolly'. | |
| * Define your filename, such as: yourtranslationfile-en_GB.mo | |
| * Define the location, for example: wp-content/languages/textdomain/yourtranslationfile-en_GB.mo | |
| */ | |
| function switch_divi_to_en( $mofile, $domain ) { | |
| if ( $domain === 'et_builder' && get_current_user_id() == 9) { | |
| $mofile = get_template_directory() . '/includes/builder/languages/en_US.mo'; | |
| } | |
| return $mofile; | |
| } | |
| #endregion Set Divi's backend to English for Oli's user account |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment