Title: Reverse order posting
Last modified: August 18, 2016

---

# Reverse order posting

 *  [wiredkiwis](https://wordpress.org/support/users/wiredkiwis/)
 * (@wiredkiwis)
 * [21 years, 5 months ago](https://wordpress.org/support/topic/reverse-order-posting/)
 * Can this be done in WP?
    I have a blog set to posts paged but I want the posts
   to show the oldest first. Have hunted but cannot find a mention of it. Anyone
   like to point me in the right direction?

Viewing 15 replies - 1 through 15 (of 18 total)

1 [2](https://wordpress.org/support/topic/reverse-order-posting/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/reverse-order-posting/page/2/?output_format=md)

 *  [Joshua Sigar](https://wordpress.org/support/users/alphaoide/)
 * (@alphaoide)
 * [21 years, 5 months ago](https://wordpress.org/support/topic/reverse-order-posting/#post-107667)
 * [http://blog.carthik.net/vault/2004/07/10/getposts-upgraded/](http://blog.carthik.net/vault/2004/07/10/getposts-upgraded/)
 *  [Mark (podz)](https://wordpress.org/support/users/podz/)
 * (@podz)
 * [21 years, 5 months ago](https://wordpress.org/support/topic/reverse-order-posting/#post-107682)
 * Reverse order posts:
    [http://wordpress.org/support/3/15749](http://wordpress.org/support/3/15749)
   This is from the first post ever, not the first post of the day.
 *  [TechGnome](https://wordpress.org/support/users/techgnome/)
 * (@techgnome)
 * [21 years, 5 months ago](https://wordpress.org/support/topic/reverse-order-posting/#post-107705)
 * Open wp-blog-header.php
    Look for this line: ` $where .= $search.$whichcat.$whichauthor;
   if ((empty($order)) || ((strtoupper($order) != 'ASC') && (strtoupper($order) !
   = 'DESC'))) { $order='DESC'; }  It will be a little more than half way down. 
   Add the following right after that. If you want to change the order on some categories,
   try this:  if ('11' == $cat) { $order='ASC'; }  Changing the 11 to any cat you
   want. If you want to change the order for all posts in all categories then remove
   the first & third lines of the above code. If you check out my site, you’ll see
   that most of the site is ordered normaly – newer first. But any of the sections
   under Writtings & Scribblings are ordered Oldest first. TG
 *  Thread Starter [wiredkiwis](https://wordpress.org/support/users/wiredkiwis/)
 * (@wiredkiwis)
 * [21 years, 5 months ago](https://wordpress.org/support/topic/reverse-order-posting/#post-107756)
 * Sorted..Thanks all
    as stated by the above posts on about line 680’ish in wp-
   blog-header.php: `$order='DESC'; `changed to ` $order='ASC'; ` Damn that was 
   easy 🙂 :another happy wp user:
 *  [Cornwell](https://wordpress.org/support/users/cornwell/)
 * (@cornwell)
 * [21 years, 1 month ago](https://wordpress.org/support/topic/reverse-order-posting/#post-108359)
 * In version 1.5 (just installed) the code isn’t in wp-blog-header.php but I found
   it in wp-includes/classes.php on line 460.
 * I can get it to change the order on all categories, simply by changing ‘DESC’
   to ‘ASC’ but the change to some categories doesn’t seem to work, presumably because
   the variable isn’t called $cat any more?
 * Roger Cornwell
 *  [Cornwell](https://wordpress.org/support/users/cornwell/)
 * (@cornwell)
 * [21 years, 1 month ago](https://wordpress.org/support/topic/reverse-order-posting/#post-108362)
 * Well, a lack of responses to my post (above) led me to investigate further. And
   it seems to be surprisingly simple. In the example above, instead of
 * ` if ('11' == $cat) {`
    ` $order='ASC';` ` }`
 * you need to code
 * ` if ('11' == $q['cat']) {`
    ` $q['order']='DESC';` ` }`
 * Roger
 *  [dannyman](https://wordpress.org/support/users/dannyman/)
 * (@dannyman)
 * [21 years ago](https://wordpress.org/support/topic/reverse-order-posting/#post-108369)
 * Hi.
 * Here is how to RECURSIVELY reverse-order a group of categories, by hacking .htaccess.
 * Compare:
    [http://dannyman.toldme.com/category/technology/](http://dannyman.toldme.com/category/technology/)
 * Contrast:
    [http://dannyman.toldme.com/category/world-tour/](http://dannyman.toldme.com/category/world-tour/)
   [http://dannyman.toldme.com/category/world-tour/jordan/](http://dannyman.toldme.com/category/world-tour/jordan/)
 * Okay, howto?
 * In my .htaccess, I put this:
    RewriteRule ^category/(world-tour.+)/?$ /index.
   php?category_name=$1&order=ASC [QSA,L]
 * Right before this line:
    RewriteRule ^category/(.+)/?$ /index.php?category_name
   =$1 [QSA,L]
 * Ditto for chronological archives:
    RewriteRule ^(archive)/?([0-9]+)?/?$ /index.
   php?pagename=$1&page=$2&order=ASC [QSA,L]
 *  [dannyman](https://wordpress.org/support/users/dannyman/)
 * (@dannyman)
 * [21 years ago](https://wordpress.org/support/topic/reverse-order-posting/#post-108370)
 * I recently added paged category archive posting. I realized things eren’t working
   quite right, so now my `.htaccess` has been amended:
 * `# Reverse-Order pages within world-tour/
    RewriteRule ^category/(world-tour.*)/
   page/?([0-9]{1,})/?$ /index.php?category_name=$1&paged=$2&order=ASC [QSA,L] RewriteRule
   ^category/(.+)/page/?([0-9]{1,})/?$ /index.php?category_name=$1&paged=$2 [QSA,
   L] # Reverse-Order pages within world-tour/ RewriteRule ^category/(world-tour.*)/?
   $ /index.php?category_name=$1&order=ASC [QSA,L] RewriteRule ^category/(.+)/?$/
   index.php?category_name=$1 [QSA,L]
 *  [rgkeir](https://wordpress.org/support/users/rgkeir/)
 * (@rgkeir)
 * [20 years, 10 months ago](https://wordpress.org/support/topic/reverse-order-posting/#post-108376)
 * This is why I love WP. I just decided I needed to reverse order
    posts in some
   categories and it took me all of about 2 minutes to find 2 different solutions.
 * Thank you all – the forums are terrific and WP rocks.
 *  [damino](https://wordpress.org/support/users/damino/)
 * (@damino)
 * [20 years, 5 months ago](https://wordpress.org/support/topic/reverse-order-posting/#post-108384)
 * Thank you to Cornwell : that is the solution !
    Just a note : use ‘ASC’ instead
   of ‘DESC’, if not the code is added for nothing !!!
 *  [nieuws](https://wordpress.org/support/users/nieuws/)
 * (@nieuws)
 * [20 years, 5 months ago](https://wordpress.org/support/topic/reverse-order-posting/#post-108385)
 * ASC will do the job indeed. You can also try and write your own function. Fairly
   easy even without PHP knowledge.
 *  [stonegauge](https://wordpress.org/support/users/stonegauge/)
 * (@stonegauge)
 * [20 years, 2 months ago](https://wordpress.org/support/topic/reverse-order-posting/#post-108391)
 * How woudl I accomplish this in WP 2.0? I want to chronologically list my archives(
   probably specifically)…
 *  [viper007bond](https://wordpress.org/support/users/viper007bond/)
 * (@viper007bond)
 * [20 years, 2 months ago](https://wordpress.org/support/topic/reverse-order-posting/#post-108392)
 * There is no need to be editing core files or rewrite rules here people.
 * Just use this right above your Loop:
 * [http://codex.wordpress.org/Template_Tags/get_posts](http://codex.wordpress.org/Template_Tags/get_posts)
 * See also (same kinda thing, but this example sorts by title rather than date):
 * [http://codex.wordpress.org/Alphabetizing_Posts](http://codex.wordpress.org/Alphabetizing_Posts)
 *  [ferientechniker](https://wordpress.org/support/users/ferientechniker/)
 * (@ferientechniker)
 * [20 years, 1 month ago](https://wordpress.org/support/topic/reverse-order-posting/#post-108398)
 * The correct code for wp2.01 is:
    (wp-includes/classes.php)
 * after:
    if ((empty($q[‘order’])) || ((strtoupper($q[‘order’]) != ‘ASC’) && (strtoupper(
   $q[‘order’]) != ‘DESC’))) { $q[‘order’]=’DESC’; }
 * type: (change 23 to your category number)
 * if (’23’ == ($q[‘cat’])) {
    $q[‘order’]=’ASC’; }
 *  [jabash](https://wordpress.org/support/users/jabash/)
 * (@jabash)
 * [20 years ago](https://wordpress.org/support/topic/reverse-order-posting/#post-108399)
 * How would this be done by a a user selection?

Viewing 15 replies - 1 through 15 (of 18 total)

1 [2](https://wordpress.org/support/topic/reverse-order-posting/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/reverse-order-posting/page/2/?output_format=md)

The topic ‘Reverse order posting’ is closed to new replies.

## Tags

 * [chronological](https://wordpress.org/support/topic-tag/chronological/)
 * [post order](https://wordpress.org/support/topic-tag/post-order/)

 * 18 replies
 * 16 participants
 * Last reply from: [zannmarketing](https://wordpress.org/support/users/zannmarketing/)
 * Last activity: [19 years, 9 months ago](https://wordpress.org/support/topic/reverse-order-posting/page/2/#post-108402)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
