WPML
apply_filters( 'wpml_post_duplicates', int $master_post_id )
ประเภท
filter
เวอร์ชันของ WPML
3.2

คำอธิบาย

คืนค่า ID ของโพสต์ที่ทำสำเนาจาก ID ของโพสต์ต้นฉบับ

อาร์กิวเมนต์

$master_post_id
(int) (จำเป็น) ID โพสต์ต้นฉบับที่มีการทำสำเนา

ตัวอย่างการใช้งาน

ตัวอย่าง
// $my_duplications will return an associative array with language codes as indexes and post_ids as values
$my_duplications = apply_filters( 'wpml_post_duplicates', 28 );

ผลลัพธ์จะมีลักษณะดังนี้:
Array
(
    [de] => 30
    [el] => 73
)

หากพยายามส่งผ่าน ID โพสต์ที่ไม่ได้ใช้เป็นโพสต์ต้นฉบับเพื่อสร้างการทำสำเนา ฟิลเตอร์จะส่งคืนอาร์เรย์ว่าง เพื่อแสดงให้เห็นชัดเจนยิ่งขึ้น โปรดเปรียบเทียบตัวอย่างด้านล่างกับตัวอย่างที่ให้ไว้ด้านบน
ตัวอย่าง
// note that I use post ID 30 This is the German duplicated post from the first example above
$my_duplications = apply_filters( 'wpml_post_duplicates', 30 );

และผลลัพธ์:
Array
(
)

wpml_element_translation_type, wpml_is_translated_post_type, wpml_is_translated_taxonomy, wpml_master_post_from_duplicate, wpml_element_has_translations

ฮุก การหาสถานะการแปลของเนื้อหา ทั้งหมด 6 รายการ →