polylang 自定义产品属性
polylang custom product attributes
是否可以使用 Polylang Pro 翻译自定义产品属性?
我在任何地方都看不到翻译自定义产品属性的选项。
答案来自Polylang!
我需要取消同步自定义产品属性。
The developper need to use the pllwc_copy_post_metas filter. It will
allow you to uncopied and unsynchronized the product_attribute and
attribute metas. Be careful because these 2 metas included custom and
global attributes. That's mean the developper must target only the
custom attributes inside this filter (that's required to get a fair
knownledge of WooCommerce).
The pllwc_copy_post_metas filter is documented in
polylang-wc/include/product-language-cpt.php
The developper may need to unhook the 3 actions in
polylang-wc/products.php at line 30-33 to allow you to have global
attributes in one language and custom product attributes in another.
add_filter("pllwc_copy_post_metas", function($to_copy, $sync, $from, $to, $lang){
unset($to_copy['my_custom_product_attribute_name']);
return $to_copy;
}, 1, 5);
是否可以使用 Polylang Pro 翻译自定义产品属性?
我在任何地方都看不到翻译自定义产品属性的选项。
答案来自Polylang! 我需要取消同步自定义产品属性。
The developper need to use the pllwc_copy_post_metas filter. It will allow you to uncopied and unsynchronized the product_attribute and attribute metas. Be careful because these 2 metas included custom and global attributes. That's mean the developper must target only the custom attributes inside this filter (that's required to get a fair knownledge of WooCommerce).
The pllwc_copy_post_metas filter is documented in polylang-wc/include/product-language-cpt.php
The developper may need to unhook the 3 actions in polylang-wc/products.php at line 30-33 to allow you to have global attributes in one language and custom product attributes in another.
add_filter("pllwc_copy_post_metas", function($to_copy, $sync, $from, $to, $lang){
unset($to_copy['my_custom_product_attribute_name']);
return $to_copy;
}, 1, 5);