【发布时间】:2020-04-20 17:47:22
【问题描述】:
我必须将一些参数回显到 woocommerce 快速编辑行。 (编辑器无需打开 woocommerce 产品就可以更轻松地决定放什么价格。)
wc_get_product_terms 是获取精确参数的好功能,但我需要那里发布 ID。 使用 add_action( 'woocommerce_product_quick_edit_end' 我可以将其添加到快速编辑底部。
有谁知道,如何用php实现post id? 一半的代码在这里:
add_action( 'woocommerce_product_quick_edit_end', function () {
//how to get the post id in each quick edit row with php?
$height = array_shift( wc_get_product_terms( $post->ID, 'pa_height', array( 'fields' => 'names' ) ) );
$width = array_shift( wc_get_product_terms( $post->ID, 'pa_width', array( 'fields' => 'names' ) ) );
$radius = array_shift( wc_get_product_terms( $post->ID, 'pa_radius', array( 'fields' => 'names' ) ) );
} );
【问题讨论】:
标签: php wordpress woocommerce