Support

Account

Home Forums General Issues WPML Translations with ACF

Unread

WPML Translations with ACF

  • Hello

    I’m having an issue using ACF with WPML translations. For some reason the “get_field” doesn’t seem to work for any translated page, but works for the default language (en) fine and gets the field.

    if ( defined( 'ICL_LANGUAGE_CODE' ) ) {
            $lang_code = ICL_LANGUAGE_CODE;
    }
    $our_products = get_field($lang_code . '_our_products', 'options');
    
    <?php echo $our_products; ?>

    There are available fields for each language code and it is collecting the language code fine in “$lang_code”. This also only shows on the default language but not translated pages:

    $our_products = get_field('en_our_products', 'options');
    
    <?php echo $our_products; ?>

    Any suggestions appreciated.

    Thanks!

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.