title: Lookup active WooCommerce Membership and loop results
body: <p>I run WordPress, WooCommerce, WooCommerce Memberships &amp; WooCommerce Subscriptions.</p>
  
  <p>Here I'm trying to lookup the user and the memberships they have purchased, each membership is basically a product, and then I'm attempting to loop and show membership information that they have subscribed to - featured image and name of each membership.</p>
  
  <p>The code I have below lists all memberships and I can't figure out what I'm doing wrong.</p>
  
  <pre><code>&lt;div id="sidebar"&gt;
      &lt;div class="sidebar-title"&gt;
          &lt;h2&gt;My Subscriptions&lt;/h2&gt;
      &lt;/div&gt;
      &lt;div class="sidebar-body"&gt;
          &lt;div class="channel-package-list"&gt;
              &lt;?php
                  $args = array(
                      'post_type' =&gt; 'product',
                      'posts_per_page' =&gt; 20,
                      );
                  $loop = new WP_Query( $args );
                  if ( $loop-&gt;have_posts() ) {
  
                  // get all active memberships for a user; 
                  // returns an array of active user membership objects
                  $user_id = get_current_user_id();
  
                  $args = array( 
                    'status' =&gt; array( 'active', 'complimentary', 'pending', 'free_trial' ),
                  );  
  
                  $active_memberships = wc_memberships_get_user_memberships( $user_id, $args );
  
                      while ( $loop-&gt;have_posts() ) : $loop-&gt;the_post(); 
                      if ( ! empty( $active_memberships ) ) {?&gt;
              &lt;div class="package-list-item"&gt;
                  &lt;div class="active-package"&gt;&lt;i class="fa fa-check" aria-hidden="true"&gt;&lt;/i&gt;&lt;/div&gt;
                  &lt;a href="javascript:;" class="group-link" data-id="27"&gt;
                      &lt;figure&gt;
                          &lt;img src="&lt;?php echo get_the_post_thumbnail_url($post , 'thumbnail'); ?&gt;" class="img-responsive" style="max-width: 100px; max-height: 100px" alt=""&gt;
                          &lt;figcaption&gt;&lt;?php echo get_the_title($post ); ?&gt;&lt;/figcaption&gt;
                      &lt;/figure&gt;
                  &lt;/a&gt;
              &lt;/div&gt;
              &lt;?php } endwhile;
                  } else {
                  echo __( 'No packages found' );
                  }
                  wp_reset_postdata(); ?&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>