title: Filter custom post type shortcode output by category WordPress
body: <p>I've created a custom post type for a "Clubs" section on a site, and I need to filter those clubs by their categories, using a shortcode.</p>
  
  <p>Not entirely sure why the shortcode isn't working to filter the clubs by category (it does display all clubs).</p>
  
  <p>For example, if one of the categories is AV Clubs, I've tried using both the title [club category="AV Clubs"] and the slug [club category="av-clubs"]. </p>
  
  <pre><code>// Shortcode
  function shortcode_club_viusu( $atts ) {
  //default arguments
  $args = shortcode_atts( array(
      'cat' =&gt; null,
      'category' =&gt; '',
      'order' =&gt; 'DESC',
      'orderby' =&gt; 'date',
      'posts_per_page'=&gt; -1,
      'post_type' =&gt; 'club'
  ), $atts );
  
  $content = "";
  
  // The Query
  $the_query = new WP_Query( $args );
  
  // The Loop
  if ( $the_query-&gt;have_posts() ) {
      //beginning of the FAQ element
      $content .= '&lt;ul class="collapsible" data-collapsible="accordion"&gt;';
  
      while ( $the_query-&gt;have_posts() ) {
          $the_query-&gt;the_post();
  
          $content .= '&lt;li&gt;';
          $content .= '&lt;div class="collapsible-header"&gt;'.get_the_title().'&lt;/div&gt;';
          $content .= '&lt;div class="collapsible-body"&gt;&lt;p&gt;'.get_the_content().'&lt;/p&gt;&lt;/div&gt;';
          $content .= '&lt;/li&gt;';
      }
  
      //closing the FAQ element
      $content .= '&lt;/ul&gt;';
  
  } else {
      $content .= "No Clubs found";
  }
  /* Restore original Post Data */
  wp_reset_postdata();
  
  return $content;
  }
  add_shortcode( 'club', 'shortcode_club_viusu' );
  </code></pre>