Support

Account

Home Forums General Issues Use ACF as multilanguage solution Reply To: Use ACF as multilanguage solution

  • WPML is supposed to be the best multilingual plugin available, but like you I’m not completely sold on it.

    In order to have a site with multiple languages you’ll need to have some setting that is global to tell what language the site is supposed to be displaying. I would use this variable. I would also stick with standard language codes like “en”, “fr”, “es”, etc. I would then name all of my fields consistently using that as either a prefix of suffix to my field name.

    You could then create a function something like the following. This is just a quick idea. In reality I’d more than likely make this a filter or something more complicate because this does not account for all the details, but it would work.

    
    function get_multilingual_field($field_name) {
        global $language;
        $value get_field($field_name.'_'.$language);
        if (!$value) {
            // no value returned for language
            // get the default
            $value = get_field($field_name);
        }
        return $value;
    }