Support

Account

Home Forums General Issues Options page + polylang Reply To: Options page + polylang

  • So my solution is to register as many options pages as the number of languages we have. Each options page has a unique page_id:

    foreach (['ru', 'en', 'es', 'de'] as $lang) {
    
        acf_add_options_sub_page([
            'page_title' => "Page name ${$lang}",
            'menu_title' => __("Page name ${$lang}", 'textdomain'),
            'menu_slug' => "page-name-${lang}",
            'post_id' => $lang,
            'parent' => 'parent-slug'
        ]);
    
    }

    Then there’s a need to create a field group and duplicate it as many times as the number of options pages we have registered. Each options page has it’s own ID so fields names can be the same.

    Now we can simply do:
    the_field('my_field_name', 'en');

    or even:
    the_field('my_field_name', pll_current_language('slug'));