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

คำอธิบาย

  • รับ trid (ID ของกลุ่มการแปล) ของอิลิเมนต์ที่แปลแล้ว ซึ่งจำเป็นสำหรับฟิลเตอร์ wpml_get_element_translations และอื่น ๆ ที่ต้องการอาร์กิวเมนต์นี้
  • เรียนรู้เพิ่มเติมเกี่ยวกับ trid ในหน้าเอกสารประกอบ ตารางของ WPML

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

$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 "trid" of the "Sample Page" page. 
$trid = apply_filters( 'wpml_element_trid', NULL, 2, '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 รายการ →