Php 如何在每个快速编辑项目中获取帖子ID
我必须回显一些参数以快速编辑行。这使得编辑在不打开woocommerce产品的情况下,更容易决定要发布的价格 wc_get_product_terms是获取EXACT参数的好函数,但我需要那里的post ID。 使用添加操作“woocommerce\u product\u quick\u edit\u end”,我可以将此添加到快速编辑底部 有人知道如何用php实现post id吗? 这里有一半代码:Php 如何在每个快速编辑项目中获取帖子ID,php,wordpress,woocommerce,Php,Wordpress,Woocommerce,我必须回显一些参数以快速编辑行。这使得编辑在不打开woocommerce产品的情况下,更容易决定要发布的价格 wc_get_product_terms是获取EXACT参数的好函数,但我需要那里的post ID。 使用添加操作“woocommerce\u product\u quick\u edit\u end”,我可以将此添加到快速编辑底部 有人知道如何用php实现post id吗? 这里有一半代码: add_action( 'woocommerce_product_quick_edit_end
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' ) ) );
} );
您是否尝试获取\u id而不是$post->id?可能值得一试。
参考: