I got an array of orders ID's and 'post__in' => $orders_ids
to embed them in a WP_Query
:
$filters_orders = array(
'post_status' => 'processing',
'post_type' => 'shop_order',
'posts_per_page' => 10,
'post__in' => $orders_ids,
'orderby' => 'modified',
'order' => 'ASC'
);
$loop = new WP_Query($filters_orders);
while ($loop->have_posts()) {
$loop->the_post();
$order = new WC_Order($loop->post->ID);
<HERE_MY_CUSTOM_HTML_TABLE>
}
I am filtering "processing" order status only, but it doesn't work and I get all kind of status.
What I am doing wrong? How to filter order status correctly in this WP_Query?
In a
WP_Query
, you need to use thepost_status
slugs like in the database tablewp_posts
… All orders status start with "wc-
":So in your case:
'post_status' => 'wc-processing'
.This should work now.