Home Forums General Issues Options page + polylang


Options page + polylang

    • wube

    • February 3, 2016 at 3:20 am

    ACF works great with Polylang. Everything works out of the box as expected. No dirty hacks are needed… except options page. Is there any way to make it translatable?

    Now I use a workaround, I duplicate fields groups and add prefixes to all the fields. But I don’t like this solution. Is there a better way?

    I could possibly provide a custom post_id value when registering an options page and save options page values in a regular post. But It’s still a hacky solution because it’s database dependant.

    • wube

    • February 4, 2016 at 3:55 am

    OK, I mark it solved. I’ve just found that options page doesn’t require an ID of existing page. I can use any string as a post_id.

    • wube

    • February 4, 2016 at 10:10 am

    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) {
            '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'));

    • philby

    • July 13, 2016 at 7:03 pm

    Thanks wube, creating page-specific option subpages has helped me a lot.
    However, I’m not sure as to why you duplicate your field groups โ€“ why not simply assign the same field group to the various option pages?

    • wube

    • July 15, 2016 at 2:33 am

    why not simply assign the same field group to the various option pages?

    You’re right. Thanks for a tip. I have no idea why I did it this way ๐Ÿ™‚

  • Another way of dealing with this core-unsupported feature is to use the following plugin:

    I’ve just tried it out and it allows you to have the same option-page for different languages. You can edit them by changing the language in the admin-top-menubar.

  • Thanks @wube your solution worked great for me. I’ve expanded it a little bit more to have these option pages:

    – Global Options (options same for all languages, e.g., social profile links)
    – Options (EN) (options specific to English language)
    – Options (IT) (options specific to Italian language)

     * ACF Options Page
    if ( function_exists( 'acf_add_options_page' ) ) {
      // Main Theme Settings Page
      $parent = acf_add_options_page( array(
        'page_title' => 'Theme General Settings',
        'menu_title' => 'Theme Settings',
        'redirect'   => 'Theme Settings',
      ) );
      // Global Options
      // Same options on all languages. e.g., social profiles links
      acf_add_options_sub_page( array(
        'page_title' => 'Global Options',
        'menu_title' => __('Global Options', 'text-domain'),
        'menu_slug'  => "acf-options",
        'parent'     => $parent['menu_slug']
      ) );
      // Language Specific Options
      // Translatable options specific languages. e.g., social profiles links
      $languages = array( 'it', 'en' );
      foreach ( $languages as $lang ) {
        acf_add_options_sub_page( array(
          'page_title' => 'Options (' . strtoupper( $lang ) . ')',
          'menu_title' => __('Options (' . strtoupper( $lang ) . ')', 'text-domain'),
          'menu_slug'  => "options-${lang}",
          'post_id'    => $lang,
          'parent'     => $parent['menu_slug']
        ) );


    And just like @philby mentioned, you can set an option group to show on all language specific option pages.

    Hope it helps someone looking for the complete solution. ๐Ÿ™‚

    @alchemistics I tried the plugin, it indeed works, but a bit buggy as in initial stages I assume. For example, when you select to show all languages, the options page is empty again so could confusing for normal users.

  • I tried it, set the locations rule to the different lang-country options I made available via the snippet (โ€˜ORโ€™ rule), but if I change a value in e.g. โ€˜Site Options ENโ€™, the value also changes in โ€˜Site Options FR-FRโ€™, that canโ€™t be right I think ? What am I missing ??

    • beapi

    • October 22, 2018 at 11:57 pm

    Hi there the ACF community ๐Ÿ™‚
    We did plugin to support this core-unsupported feature.
    If you have some issues, inquirements, improvements or requests please refer to the github. We will be glad to help you.
    @tomhermans, @zeshanshani note that we recently updated the plugin, so maybe your issue has been fixed. Please check it out!
    Many thanks

Viewing 9 posts - 1 through 9 (of 9 total)

You must be logged in to reply to this topic.

We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.