WP_Query while shows blank page

I want to get all Orders from WooCommerce over WP_Query()

but the while is not ending and i got a blank page
ourrent query:

Read More
        $type = 'shop_order';
        $args = array(
            'post_type'      => $type,
            'post_status'    => 'any',
            'posts_per_page' => -1,
        );


        $the_query = new WP_Query( $args );

        var_dump($the_query); //This Showes something


        if ( $the_query->have_posts() ) {

            //here comes the blank page
            while ( $the_query->have_posts() ) {

            }

        }
        wp_reset_postdata(); 

The var_dump($the_query) is here http://laravel.io/bin/KmwlK

Related posts

Leave a Reply

1 comment

  1. In while ( $the_query->have_posts() ), you didn’t put the function the_post(). Maybe use it will solve your problem.

    //here comes the blank page
    while ( $the_query->have_posts() ) {
        the_post(); // add it
    }