Support

Account

Home Forums ACF PRO WPML: Get field from options from specific/other-than-active languages

Solving

WPML: Get field from options from specific/other-than-active languages

  • Hi there,

    I thought this must be possibly by just switching languages, but apparently it doesn’t:

    I have a (non-translated, i.e. each language ‘fills’ the same options fields) options field group, and referencing those fields e.g. in a footer does work neatly – it pulls the right version of the option on every language. As soon as I try to get a specific language’s field it still always returns the current language’s field content.
    For example:
    I use do_action( 'wpml_switch_language', 'de' ); to switch language to ‘de’. Normally, after that switch I should be able to grab fields from that specific language, no? Or retrieve a custom field for that very page I am on, but it still only gets data from the active language.

    Is there something wrong in my thinking? I have read all the other related posts, but to no avail. Since my options page is old (the project is), I didn’t strive to translate it, so I have identical option field names in all languages.

  • There is a topic here that may help you, it deals with the default language, but I think it can be used to set any language before getting a field https://support.advancedcustomfields.com/forums/topic/get-option-from-wpml-default-language/

  • Hey John, thanks for the link (and sorry for the delay in responding)! Is there a way via acf_get_setting to not only get the current or default language, but a language of choice?

    What I actually need and am working on is a foreach loop through all WPML languages and the retrieval of a specific field from the options for each of the languages, to be exact.

    Thank you in advance!

Viewing 3 posts - 1 through 3 (of 3 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.