I'm attempting to pull in some order information from the "shop_order
" post_type
.
This is on a multisite network, so I'm using switch_to_blog(1)
. When I set the post type as "post" it works great and I get the posts from the correct site. When I set the post_type
to "shop_order
" I get nothing, despite there being 20,000 'shop_order
' records in the database.
switch_to_blog(1);
$args = array (
//'post_type' => 'post',
'post_type' => 'shop_order',
'posts_per_page' => 2,
);
$posts = get_posts( $args );
restore_current_blog();
var_dump($posts);
post_status
, which defaults topublish
– Milo Mar 13 '16 at 15:49$posts
as local variable, rather use something like$posts_array
– Pieter Goosen Mar 13 '16 at 15:55