title: Why do I have WooCommerce orders, but no posts of type shop_order?
body: <p>I have some 30 orders in my shop. I am trying to loop over all orders, but I can't retrieve any orders. Here's the code:</p>
  
  <pre><code>$args = array (
              'post_type'         =&gt; 'shop_order',
              'posts_per_page'    =&gt; - 1
  );
  
  $loop = new WP_Query($args);
  
  while ($loop-&gt;have_posts()) {
      // do some work here
  }
  </code></pre>
  
  <p>The loop never runs. I tried printing a count of all post types:</p>
  
  <pre><code>$args = array (
          'post_type'         =&gt; 'any',
          'posts_per_page'    =&gt; - 1
  );
  
  $loop = new WP_Query($args);    
  $types = array();
  
  while ($loop-&gt;have_posts()) {
      $loop-&gt;the_post();
      $post_id = get_the_ID();
      $type = get_post_type($post_id);
      if ($types[$type]) $types[$type]++;
      else $types[$type] = 1; 
  }
  
  foreach ($types as $type =&gt; $count) {
      echo "{$type}: {$count} ";
  }
  </code></pre>
  
  <p>This is printing <code>product: 30 page: 5 post: 1</code>, i.e. no <code>shop_order</code>s. I guess I'm missing something very obvious, but it's not so obvious to me what that obvious thing is!</p>
  
  <p>UPDATE: I am now retrieving all orders with this code:</p>
  
  <pre><code>$args = array(
          'post_type'         =&gt; 'shop_order',
          'posts_per_page'    =&gt; -1
  );
  
  $posts = get_posts($args);
  </code></pre>
  
  <p>That doesn't answer the question though. But it's a solution.</p>