Home › Forums › General Issues › Translating form field labels in frontend with Polylang › Reply To: Translating form field labels in frontend with Polylang
Thanks, this was great find!
I just went thru the the code of acf_form processing and came here to suggest a new hook, but you’ve found existing one!
This works even if you don’t use Polylang, just make sure translations are in your .mo & .po files.
add_filter('acf/prepare_field', function ($field) {
if (!is_admin()) {
$field['label'] = __($field['label'], 'textdomain' );
}
return $field;
}, 10, 1);
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
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 Privacy Policy. If you continue to use this site, you consent to our use of cookies.