你好,
我在获取Woocommerce产品WP\\U PostObject的post\\U状态时遇到问题。我得到所有执行此查询的产品:
$onlineShopProducts = get_posts([
\'post_type\' => [\'product\', \'product_variation\'],
\'orderby\' => \'post_title\',
\'order\' => \'ASC\',
\'numberposts\' => -1
]);
现在,我想在foreach循环期间过滤掉处于状态草稿中的所有产品:foreach ($onlineShopProducts as $onlineShopProduct){
if($onlineShopProduct->post_status != \'publish\'){
continue;
}
doSomething($onlineShopProduct)
}
但是$onlineShopProduct->;post\\U status和get\\U post\\U status($onlineShopProduct->;ID)都返回;“发布”;,即使它们已经设置好了;草稿“;在“产品编辑”视图中。。。(德语)是否有某种post\\u meta我必须查询,或者这是某种已知的bug?我如何筛选出草拟的产品?您好