ข้ามการนำทาง

Open

Reported for: Advanced Custom Fields Multilingual 2.1.4.2

Overview of the issue

If you’re using a custom order for related posts in a Relationship or Post Object field, you’ll see the order is not keep when translating the post. Instead, the posts will be ordered by ID.

Workaround

You can add this snippet to your theme’s functions.php.

Note that where it says

1
type=relationship

you may need to change to

1
type=post_object

depending on the post type you’re using.

1
2
3
4
5
6
7
8
9
10
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;
}

แสดงความคิดเห็น

โปรดอยู่ในหัวข้อและให้ความเคารพผู้อื่น หากคุณต้องการความช่วยเหลือในประเด็นที่ไม่เกี่ยวข้องกับโพสต์นี้ ให้ใช้ฟอรั่มสนับสนุนของเราเพื่อเริ่มการแชทหรือส่งตั๋ว.

คุณสามารถใช้แท็กเหล่านี้:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>