Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial


Maja B.
Maja B.
12,984 Points

How do you translate Advanced Custom Fields?


Mathieu Delporte, who has helped me at this forum post https://teamtreehouse.com/forum/wordpress-custm-post-type-and-fields-translation-of-the-custom-field has convinced me that the best way to translate custom fields created with ACF plugin is to use WPML.

But WPML is a plugin that you need to buy. Its not very expensive. But before I go and buy it, I would like to double check if there is some other way to translate ACF fields. What do you do? How do you translate it?

It seems like a very basic thing. As soon as you use the two famous plugins CPT and ACF and as soon as you live in an non-English-native-speaking-country you bump at this challenge. So what did you do?

ACF = Advanced Custom Fields plugin

WPML = WordPress Multilingual Plugin

CPT = Custom Post Types plugin

I've never done a multilingual WP site, but have you tried Polylang or qTranslate-X?

Maja B.
Maja B.
12,984 Points

Hi, yes with Polylang it is possible to do it! I have just installed it and played with it.

But the problem is that you need to make a special custom page for every language. So for example if I have a custom post type Movie and one of the movies is Star Wars I need to make a special page for Star wars in English and a special page for Star Wars in German. So its kind of inefficient because I need to repeat things. Anyway, thanks for pointing me to Polylang.

Till now I've used qTranslate and was trying to use ACF qTranslate (it had errors when I've activated it and all the instructions to fix this errors seemed very complicated to me) and I was not able to translate custom field with them at all.

However, with Polylang it is possible and it helps me a lot!

I linked to qTranslate-X, which is a fork of the original qTranslate plugin. The original qTranslate plugin is apparently no longer being developed. The qTranslate-X developers have apparently fixed a bunch of bugs that were in the original plugin.

If you look at qTranslate-X's FAQ section it says that it's possible to translate theme custom fields. There's also another FAQ that talks about custom configuration fields.

Maja B.
Maja B.
12,984 Points

Thanks ... but still the problem remains.

How to make the custom field called 'description' translatable?

<p><?php the_field ( 'description' ); ?></p>
Maja B.
Maja B.
12,984 Points

Hi, I've finally learned how to translate a custom field and I'm very happy to share it with you. So, if anyone needs it - here's a free of charge multilingual solution for WordPress sites:

Preparation part:

Translation part:

  • Install qTranslate X plugin (https://wordpress.org/plugins/qtranslate-x/)

  • In the Dashborad/Settings/Language section add and enable the languages that you need. English, Deutsch and Chinese are already there. In my case I've added and enabled Slovene language).

  • Write this in your template file to tell WordPress to sort of 'detect different languages':

<p><?php _e(get_field( 'description', false, false )); ?></p>
  • Write this in the actual custom field to tell WordPress which text goes for which language. In my case I'm only using English and Slovene. But you can have as many languages as you wish.
<!--:en-->Your text in English language<!--:--><!--:sl-->Your text in Slovene language<!--:-->
  • In the Dashborad/Appearance/Widgets section - activate the widget qTranslate Language Chooser (It is part of qTranslate X plugin, so if you have the plugin installed, you also have the widget).

  • And that's it. Go to your front-end page, switch between languages and see how your text changes correspondingly.

1 Answer

Patrick Koch
Patrick Koch
40,496 Points

Thanks alot for sharing Maja,

I am also looking for a good translation option for my wp site. I also came over Polyland and qTranslate. Polylang ist way more easy for me but gets really messy if you have to create every page in everylanguage if you have 4-5 languages. qTranslate has for me a better approach too make every field language selectable. But Its for me a nogo to let a customer write

<!--:en-->Your text in English language<!--:--><!--:sl-->Your text in Slovene language<!--:-->

imagine more languages, thats gonna be really hard.

but thanks again for sharing Maja