How would I go about pulling the most popular (most used) categories?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty margin-bottom:0;







up vote
1
down vote

favorite












I am trying to use WordPress' built in function for calling a list of categories. Unfortunately there doesn't appear to be an argument for how to pull the most popular categories (say top 5). I am using the code below which is pulling in all categories. Any idea on how I could modify this to display the top 5 most used categories?



<?php 
$args = array(
'show_option_all' => '',
'orderby' => 'name',
'order' => 'ASC',
'style' => 'list',
'show_count' => 0,
'hide_empty' => 1,
'use_desc_for_title' => 1,
'child_of' => 0,
'feed' => '',
'feed_type' => '',
'feed_image' => '',
'exclude' => '1',
'exclude_tree' => '',
'include' => '',
'hierarchical' => 1,
'title_li' => __( '' ),
'show_option_none' => __( '' ),
'number' => 5, // limits the number of displayed categories
'echo' => 1,
'depth' => 0,
'current_category' => 0,
'pad_counts' => 0,
'taxonomy' => 'category',
'walker' => null,
);
wp_list_categories( $args );
?>









share|improve this question







New contributor




Peter is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

























    up vote
    1
    down vote

    favorite












    I am trying to use WordPress' built in function for calling a list of categories. Unfortunately there doesn't appear to be an argument for how to pull the most popular categories (say top 5). I am using the code below which is pulling in all categories. Any idea on how I could modify this to display the top 5 most used categories?



    <?php 
    $args = array(
    'show_option_all' => '',
    'orderby' => 'name',
    'order' => 'ASC',
    'style' => 'list',
    'show_count' => 0,
    'hide_empty' => 1,
    'use_desc_for_title' => 1,
    'child_of' => 0,
    'feed' => '',
    'feed_type' => '',
    'feed_image' => '',
    'exclude' => '1',
    'exclude_tree' => '',
    'include' => '',
    'hierarchical' => 1,
    'title_li' => __( '' ),
    'show_option_none' => __( '' ),
    'number' => 5, // limits the number of displayed categories
    'echo' => 1,
    'depth' => 0,
    'current_category' => 0,
    'pad_counts' => 0,
    'taxonomy' => 'category',
    'walker' => null,
    );
    wp_list_categories( $args );
    ?>









    share|improve this question







    New contributor




    Peter is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.





















      up vote
      1
      down vote

      favorite









      up vote
      1
      down vote

      favorite











      I am trying to use WordPress' built in function for calling a list of categories. Unfortunately there doesn't appear to be an argument for how to pull the most popular categories (say top 5). I am using the code below which is pulling in all categories. Any idea on how I could modify this to display the top 5 most used categories?



      <?php 
      $args = array(
      'show_option_all' => '',
      'orderby' => 'name',
      'order' => 'ASC',
      'style' => 'list',
      'show_count' => 0,
      'hide_empty' => 1,
      'use_desc_for_title' => 1,
      'child_of' => 0,
      'feed' => '',
      'feed_type' => '',
      'feed_image' => '',
      'exclude' => '1',
      'exclude_tree' => '',
      'include' => '',
      'hierarchical' => 1,
      'title_li' => __( '' ),
      'show_option_none' => __( '' ),
      'number' => 5, // limits the number of displayed categories
      'echo' => 1,
      'depth' => 0,
      'current_category' => 0,
      'pad_counts' => 0,
      'taxonomy' => 'category',
      'walker' => null,
      );
      wp_list_categories( $args );
      ?>









      share|improve this question







      New contributor




      Peter is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      I am trying to use WordPress' built in function for calling a list of categories. Unfortunately there doesn't appear to be an argument for how to pull the most popular categories (say top 5). I am using the code below which is pulling in all categories. Any idea on how I could modify this to display the top 5 most used categories?



      <?php 
      $args = array(
      'show_option_all' => '',
      'orderby' => 'name',
      'order' => 'ASC',
      'style' => 'list',
      'show_count' => 0,
      'hide_empty' => 1,
      'use_desc_for_title' => 1,
      'child_of' => 0,
      'feed' => '',
      'feed_type' => '',
      'feed_image' => '',
      'exclude' => '1',
      'exclude_tree' => '',
      'include' => '',
      'hierarchical' => 1,
      'title_li' => __( '' ),
      'show_option_none' => __( '' ),
      'number' => 5, // limits the number of displayed categories
      'echo' => 1,
      'depth' => 0,
      'current_category' => 0,
      'pad_counts' => 0,
      'taxonomy' => 'category',
      'walker' => null,
      );
      wp_list_categories( $args );
      ?>






      categories get-categories wp-list-categories






      share|improve this question







      New contributor




      Peter is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      share|improve this question







      New contributor




      Peter is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      share|improve this question




      share|improve this question






      New contributor




      Peter is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      asked 4 hours ago









      Peter

      153




      153




      New contributor




      Peter is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





      New contributor





      Peter is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      Peter is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          2
          down vote



          accepted










          You can order by count to order them by the number of posts they are attached to. Use number to limit the number of terms returned:



          wp_list_categories( [
          'orderby' => 'count',
          'order' => 'DESC',
          'number' => 5
          ] );





          share|improve this answer




















          • Wow I am feeling very humbled right now. I looked at the WP documentation for this function and missed this. Thank you!
            – Peter
            4 hours ago










          • Don't feel so bad, I don't think count is listed anywhere as a valid value for orderby, you have to look at the documentation for the generic get_terms to see that it's possible to do this.
            – Milo
            4 hours ago










          Your Answer







          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "110"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          convertImagesToLinks: false,
          noModals: false,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );






          Peter is a new contributor. Be nice, and check out our Code of Conduct.









           

          draft saved


          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fwordpress.stackexchange.com%2fquestions%2f316288%2fhow-would-i-go-about-pulling-the-most-popular-most-used-categories%23new-answer', 'question_page');

          );

          Post as a guest






























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          2
          down vote



          accepted










          You can order by count to order them by the number of posts they are attached to. Use number to limit the number of terms returned:



          wp_list_categories( [
          'orderby' => 'count',
          'order' => 'DESC',
          'number' => 5
          ] );





          share|improve this answer




















          • Wow I am feeling very humbled right now. I looked at the WP documentation for this function and missed this. Thank you!
            – Peter
            4 hours ago










          • Don't feel so bad, I don't think count is listed anywhere as a valid value for orderby, you have to look at the documentation for the generic get_terms to see that it's possible to do this.
            – Milo
            4 hours ago














          up vote
          2
          down vote



          accepted










          You can order by count to order them by the number of posts they are attached to. Use number to limit the number of terms returned:



          wp_list_categories( [
          'orderby' => 'count',
          'order' => 'DESC',
          'number' => 5
          ] );





          share|improve this answer




















          • Wow I am feeling very humbled right now. I looked at the WP documentation for this function and missed this. Thank you!
            – Peter
            4 hours ago










          • Don't feel so bad, I don't think count is listed anywhere as a valid value for orderby, you have to look at the documentation for the generic get_terms to see that it's possible to do this.
            – Milo
            4 hours ago












          up vote
          2
          down vote



          accepted







          up vote
          2
          down vote



          accepted






          You can order by count to order them by the number of posts they are attached to. Use number to limit the number of terms returned:



          wp_list_categories( [
          'orderby' => 'count',
          'order' => 'DESC',
          'number' => 5
          ] );





          share|improve this answer












          You can order by count to order them by the number of posts they are attached to. Use number to limit the number of terms returned:



          wp_list_categories( [
          'orderby' => 'count',
          'order' => 'DESC',
          'number' => 5
          ] );






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered 4 hours ago









          Milo

          64.2k273108




          64.2k273108











          • Wow I am feeling very humbled right now. I looked at the WP documentation for this function and missed this. Thank you!
            – Peter
            4 hours ago










          • Don't feel so bad, I don't think count is listed anywhere as a valid value for orderby, you have to look at the documentation for the generic get_terms to see that it's possible to do this.
            – Milo
            4 hours ago
















          • Wow I am feeling very humbled right now. I looked at the WP documentation for this function and missed this. Thank you!
            – Peter
            4 hours ago










          • Don't feel so bad, I don't think count is listed anywhere as a valid value for orderby, you have to look at the documentation for the generic get_terms to see that it's possible to do this.
            – Milo
            4 hours ago















          Wow I am feeling very humbled right now. I looked at the WP documentation for this function and missed this. Thank you!
          – Peter
          4 hours ago




          Wow I am feeling very humbled right now. I looked at the WP documentation for this function and missed this. Thank you!
          – Peter
          4 hours ago












          Don't feel so bad, I don't think count is listed anywhere as a valid value for orderby, you have to look at the documentation for the generic get_terms to see that it's possible to do this.
          – Milo
          4 hours ago




          Don't feel so bad, I don't think count is listed anywhere as a valid value for orderby, you have to look at the documentation for the generic get_terms to see that it's possible to do this.
          – Milo
          4 hours ago










          Peter is a new contributor. Be nice, and check out our Code of Conduct.









           

          draft saved


          draft discarded


















          Peter is a new contributor. Be nice, and check out our Code of Conduct.












          Peter is a new contributor. Be nice, and check out our Code of Conduct.











          Peter is a new contributor. Be nice, and check out our Code of Conduct.













           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fwordpress.stackexchange.com%2fquestions%2f316288%2fhow-would-i-go-about-pulling-the-most-popular-most-used-categories%23new-answer', 'question_page');

          );

          Post as a guest













































































          Comments

          Popular posts from this blog

          What does second last employer means? [closed]

          List of Gilmore Girls characters

          Confectionery