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;
}