apply_filters( 'wpml_element_has_translations', mixed $empty_value, int $element_id, string $element_type )
- ประเภท
- filter
- หมวดหมู่
- การหาสถานะการแปลของเนื้อหา
- เวอร์ชันของ WPML
- 3.2
คำอธิบาย
คืนค่า TRUE หรือ FALSE ขึ้นอยู่กับว่าประเภทโพสต์หรือคำในอนุกรมวิธานได้รับการแปลหรือไม่
อาร์กิวเมนต์
- $empty_value
- (mixed) (จำเป็น) โดยปกติแล้วนี่คือค่าที่ฟิลเตอร์จะทำการแก้ไข เราไม่ได้ทำการกรองสิ่งใดในที่นี้ ดังนั้นให้ตั้งค่านี้เป็น NULL เพื่อให้ฟังก์ชันของฟิลเตอร์ได้รับรายการอาร์กิวเมนต์แบบเต็ม
- $element_id
- (int) (จำเป็น) ID ขององค์ประกอบที่ต้องการดึงข้อมูล ใช้ term_id สำหรับเทอมของอนุกรมวิธาน และใช้ post_id สำหรับประเภทโพสต์
- $element_type
- (string) (จำเป็น) ประเภทขององค์ประกอบที่ ID นั้นสังกัดอยู่ สามารถเป็นประเภทโพสต์: post, page, attachment, nav_menu_item, {custom post key} หรืออนุกรมวิธาน: category, post_tag, nav_menu {custom taxonomy key}
ตัวอย่างการใช้งาน
ตัวอย่าง
//$is_translated will be TRUE if the custom post is translated and FALSE if it is not translated $is_translated = apply_filters( 'wpml_element_has_translations', NULL, 61, 'book' )
ฮุกที่เกี่ยวข้อง
wpml_element_translation_type, wpml_is_translated_post_type, wpml_is_translated_taxonomy, wpml_master_post_from_duplicate, wpml_post_duplicates