- Stato
- Risolto
- Segnalato per
- Advanced Custom Fields Multilingual 2.1.4.2
- Plugin/tema correlato
- Advanced Custom Fields (ACF)
Panoramica del problema
Se stai usando un ordine personalizzato per gli articoli correlati in un campo Relationship o Post Object, vedrai che l’ordine non viene mantenuto quando traduci l’articolo. Invece, gli articoli verranno ordinati per ID.
Soluzione alternativa
Puoi aggiungere questo snippet al file functions.php del tuo tema.
Nota che dove c’è scritto
type=relationship
potresti doverlo cambiare in
type=post_object
a seconda del tipo di post che stai usando.
add_filter( 'acf/load_value/type=relationship', 'format_order' );
function format_order( $value ){
$lang = apply_filters( 'wpml_current_language', null );
foreach ($value as $key => $id) {
$type = get_post_type($id);
$value[$key] = apply_filters( 'wpml_object_id', $id, $type, true, $lang);
}
return $value;
}