ภาพรวมของปัญหา
เมื่อใช้ PublishPress Authors ร่วมกับ WPML คุณอาจพบปัญหาต่อไปนี้: คุณแปลประวัติผู้เขียนในการแปลสตริง แต่โพสต์ที่แปลแล้วยังคงแสดงประวัติในภาษาเริ่มต้น
วิธีแก้ปัญหาชั่วคราว
เพิ่มโค้ดนี้ลงในไฟล์ functions.php ของธีมของคุณ หรือปลั๊กอิน code snippets จากนั้นแปลประวัติใน WPMLการแปลสตริง (โดเมน PublishPress Authors):
PHP
add_filter( 'publishpress_authors_author_attribute', function ( $value, $term_id, $attribute ) {
if ( 'description' !== $attribute || ! is_string( $value ) || '' === $value ) {
return $value;
}
return apply_filters( 'wpml_translate_single_string', $value, 'PublishPress Authors', '#' . (int) $term_id . ' Biographical Info' );
}, 10, 3 );