title: WordPress- Get post from Category by Priority
body: <p>I want get 3 posts from event custom post type. But i want to do that by category priority. If "featured" category has 3 upcoming event then i want to show 3 posts from it, if "featured" category doesn't have 3 upcoming events then i want to get posts from other category+posts without any category too.</p>
  
  <p>The end result will return 3 upcoming event. I'm a little confuse about how can i add that condition parameter on WP_Query.</p>
  
  <p>Current code(that only return maximum 3 posts from featured category)-</p>
  
  <pre><code>$events_args = array(
        'post_type'     =&gt; 'ctc_event',                
        'meta_query' =&gt; array(
          array(
            'key' =&gt; '_ctc_event_end_date',
            'value' =&gt; date_i18n( 'Y-m-d' ),
            'compare' =&gt; '&gt;=',
            'type' =&gt; 'DATE'
          ),
        ),
        'meta_key'      =&gt; '_ctc_event_start_date_start_time',
        'meta_type'     =&gt; 'DATETIME',
        'orderby'     =&gt; 'meta_value',
        'order'       =&gt; 'ASC',
        'posts_per_page' =&gt; 3,
        'tax_query' =&gt; array(
            array(
                'taxonomy' =&gt; 'ctc_event_category',
                'field'    =&gt; 'slug',
                'terms'    =&gt; 'featured',
            ),
        ),
      );
  
  $events = new WP_Query( $events_args );
  </code></pre>
  
  <p>Thanks in advance.</p>