PHP code example of pleb / acf-polylang-translatable-fields
1. Go to this page and download the library: Download pleb/acf-polylang-translatable-fields library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
pleb / acf-polylang-translatable-fields example snippets
// pll_current_language('locale') => fr_FR
$translation = get_field('acf_field_name', $post_id);
echo $translation; // "Contenu en Français"
$translations = get_field('acf_field_name', $post_id, false);
print_r($translations);
// array(
// 'en_EN' => "English content",
// 'fr_FR' => "Contenu en Français"
// );
update_field('acf_field_name', array(
'fr_FR' => "Nouveau contenu en Français"
), $post_id);