title: Get category list using wordpress query from post in wordpress
body: <p>I want to get category list but my query returns all posts</p>
  
  <pre><code> &lt;?php 
      global $post;
      $args = array(
        'post_type' =&gt; 'post',
        'posts_per_page' =&gt; 24,
        'order' =&gt; 'ASC',
        'orderby' =&gt; 'title'
      );
  
      $the_query = new WP_Query( $args );
  
      while ( $the_query-&gt;have_posts() ) { $the_query-&gt;the_post();
          if(get_the_id() == $thisId){$class = "active";}else{$class="";}
      ?&gt;
  
      &lt;li class="&lt;?php echo $class; ?&gt;"&gt;&lt;a href="&lt;?php the_permalink(); ?&gt;"&gt;&lt;?php the_title(); ?&gt;&lt;/a&gt;&lt;/li&gt;
      &lt;?php }
  
      wp_reset_postdata();
  
      ?&gt;
  </code></pre>
  
  <p>gives me all posts in output and i want to display all categories </p>