add_filter( 'wcml_product_content_fields', 'the_callback_function', 10, 2 );
- ประเภท
- filter
- หมวดหมู่
- การแทรกเนื้อหา
- เวอร์ชันของ WooCommerce Multilingual
- 3.6
คำอธิบาย
เพิ่มหรือลบฟิลด์ที่กำหนดเองในตัวแก้ไขการแปล WCML
อาร์กิวเมนต์
มีสองพารามิเตอร์ที่ส่งไปยังฟิลเตอร์นี้:- $fields
- (array) อาร์เรย์ฟิลด์กำหนดเอง
- $product_id
- (integer) ID ของผลิตภัณฑ์ต้นฉบับ
ตัวอย่างการใช้งาน
ตัวอย่าง
/*
* Add this code to the functions.php file of your theme.
*/
add_filter( 'wcml_product_content_fields', 'add_custom_fields_wcml_editor', 10, 2 );
function add_custom_fields_wcml_editor ( $fields, $product_id ) {
// Add the 'new_button_label' field to WCML Translation Editor
$fields[] = 'new_button_label';
return $fields;
}