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 ההוקים בקטגוריה איתור מצב תרגום של תוכן →