Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // display current language
- if ( defined( 'ICL_LANGUAGE_CODE' ) ) {
- echo "<pre>Current language code: ";
- print_r(ICL_LANGUAGE_CODE);
- echo "</pre>";
- }
- // get all WPML languages
- $langs = icl_get_languages('skip_missing=0&orderby=KEY&order=DIR&link_empty_to=str');
- // get acf option "seo_title" in all languages
- foreach ($langs as $lang) {
- // modify current language
- add_filter('acf/settings/current_language', function() {
- global $lang;
- return $lang['code'];
- });
- echo "<pre>seo_title [{$lang['code']}]: ";
- print_r(get_field('seo_title', 'option'));
- echo "</pre>";
- }
- // reset to original language
- add_filter('acf/settings/current_language', function() {
- return ICL_LANGUAGE_CODE;
- });
Add Comment
Please, Sign In to add comment