WPML
apply_filters( 'wpml_original_element_id', mixed $empty_value, integer $element_id, string $element_type)
ประเภท
filter
เวอร์ชันของ WPML
3.2

คำอธิบาย

  • ส่งคืน ID ของโพสต์หรือหน้าในภาษาต้นฉบับเมื่อระบุ ID ของการแปล

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

$empty_value
(mixed) (จำเป็น) โดยปกติแล้ว นี่คือค่าที่ฟิลเตอร์จะแก้ไข เราไม่ได้กรองสิ่งใดในที่นี้ ดังนั้นให้ตั้งค่านี้เป็น NULL สิ่งนี้จำเป็นสำหรับฟังก์ชันฟิลเตอร์เพื่อรับรายการอาร์กิวเมนต์แบบเต็ม
$element_id
(integer) (จำเป็น) ID ของรายการ (post_id สำหรับประเภทโพสต์, term_taxonomy_id สำหรับเทอมของอนุกรมวิธาน)
$element_type
(string) (ไม่บังคับ) ประเภทขององค์ประกอบ สามารถเป็นประเภทโพสต์: post_post, post_page, post_attachment, post_nav_menu_item, post_{custom post key} หรืออนุกรมวิธาน: tax_category, tax_post_tag, tax_nav_menu, tax_{custom taxonomy key} ค่าเริ่มต้นคือ post_post หากไม่ได้ตั้งค่า

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

ตัวอย่าง

// Get the original post ID of a translated page.
$original_id = apply_filters( 'wpml_original_element_id', NULL, 6, 'post_page' );

wpml_decode_custom_field, wpml_footer_language_selector, wpml_add_language_form_field, wpml_ls_exclude_in_menu, wpml_is_rtl, wpml_alternate_hreflang, wpml_head_langs, wpml_must_translate_canonical_url, wpml_browser_redirect_language_params, wpml_active_languages

ฮุก ข้อมูลภาษาทั่วทั้งไซต์ ทั้งหมด 29 รายการ →