Sign up ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

According to:

To show all posts in a category:

query_posts( array ( 'category_name' => 'The Category Name', 'posts_per_page' => -1 ) );

Works great, but if I want to show the posts


Anyone have any idea how to do that?

share|improve this question

2 Answers 2

up vote 2 down vote accepted

You need to use this to parameters orderby and order

<?php query_posts( array( 'category_name' => 'my_category_slug', 'orderby' => 'ID', 'order' => 'DESC', 'posts_per_page' => -1 ) ); ?>
share|improve this answer
Thanks again, it works! –  Muazam Aug 27 '11 at 20:25

the param order can list via DESC and the param orderby sort by ID for your example:

   array ( 'category_name' => 'The Category Name', 
           'posts_per_page' => -1,
           'orderby' => 'ID',
           'order' => 'DESC'

oder is only usable with ASC or DESC and orderby can use all fiels of the table posts.

share|improve this answer
Thank you! It works. –  Muazam Aug 27 '11 at 20:25

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.