Title: Reverse order posts
Last modified: August 22, 2016

---

# Reverse order posts

 *  Resolved [keelhauler](https://wordpress.org/support/users/keelhauler/)
 * (@keelhauler)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/reverse-order-posts/)
 * I want to Reverse the order my posts.
    I was using another theme, now I’m using
   twentythirteen.
 * Where do I find the .PHP file that I need to modify and which one is it to get
   my blog in reverse order. And code required.

Viewing 8 replies - 1 through 8 (of 8 total)

 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/reverse-order-posts/#post-5944642)
 * review [http://codex.wordpress.org/Plugin_API/Action_Reference/pre_get_posts](http://codex.wordpress.org/Plugin_API/Action_Reference/pre_get_posts)
 * example code (to be added into functions.php of a child theme):
 *     ```
       function reverse_order_posts( $query ) {
           if ( is_admin() || ! $query->is_main_query() ) return;
   
               $query->set( 'order', 'ASC' );
               return;
       }
       add_action( 'pre_get_posts', 'reverse_order_posts', 1 );
       ```
   
 * untested.
 * [http://codex.wordpress.org/Class_Reference/WP_Query#Order_.26_Orderby_Parameters](http://codex.wordpress.org/Class_Reference/WP_Query#Order_.26_Orderby_Parameters)
 *  Thread Starter [keelhauler](https://wordpress.org/support/users/keelhauler/)
 * (@keelhauler)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/reverse-order-posts/#post-5944658)
 * I’m a little confused.
    Are you saying in the file: /WordPress/wp-content/themes/
   twentythirteen/functions.php
 * I need to add:
    function reverse_order_posts( $query ) { if ( is_admin() || !
   $query->is_main_query() ) return;
 *  $query->set( ‘order’, ‘ASC’ );
    return; } add_action( ‘pre_get_posts’, ‘reverse_order_posts’,
   1 );
 * Does it have to be at a certain point in the file functions.php?
 * Thanks for your quick rep;y
 *  Thread Starter [keelhauler](https://wordpress.org/support/users/keelhauler/)
 * (@keelhauler)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/reverse-order-posts/#post-5944716)
 * Tried what was showed above — Did not work.
    Please Clarify 1. Yes /WordPress/
   wp-content/themes/twentythirteen/functions.php is the correct file to edit. 2
   Please show the exact code & location in file
 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/reverse-order-posts/#post-5944718)
 * the suggested method works for me.
 * make sure to clear any caches.
 * however, rather than editing the files of the theme Twenty Thirteen directly,
   create a child theme for the customizations.
    [https://codex.wordpress.org/Child_Themes](https://codex.wordpress.org/Child_Themes)
 * then add the suggested code into functions.php of the chld theme.
 * can you post a link to your site with the suggested code in place?
 *  Thread Starter [keelhauler](https://wordpress.org/support/users/keelhauler/)
 * (@keelhauler)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/reverse-order-posts/#post-5944720)
 * This is my site [http://keelhauler.org/WordPress/](http://keelhauler.org/WordPress/)
   
   It’s in standard blog order but after the trip I want it in reverse order.
 * I’ll have to read your child_themes info carefully and see what I ave to create
   and where to I place the files.
 * Thanks again for fast reply
 *  Thread Starter [keelhauler](https://wordpress.org/support/users/keelhauler/)
 * (@keelhauler)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/reverse-order-posts/#post-5944725)
 * [http://keelhauler.org/WordPress/?cat=14](http://keelhauler.org/WordPress/?cat=14)
 * Is the blog page I’m trying to reverese.
 * I created directory /WordPress\wp-content/themes/twentythirteen-child
    Files:
   style.css /* Theme Name: Twenty Thirteen Child Theme URI: [http://wordpress.org/themes/twentythirteen-child](http://wordpress.org/themes/twentythirteen-child)
   Author: the WordPress team & JK Author URI: [http://wordpress.org/](http://wordpress.org/)
   Description: Twenty Thirteen Child Theme Version: 1.4 License: GNU General Public
   License v2 or later License URI: [http://www.gnu.org/licenses/gpl-2.0.html](http://www.gnu.org/licenses/gpl-2.0.html)
   Text Domain: twentythirteen-child */ functions.php function reverse_order_posts(
   $query ) { if ( is_admin() || ! $query->is_main_query() ) return;
 *  $query->set( 'order', 'ASC' );
    return; }
 * I must need something else
 *  Thread Starter [keelhauler](https://wordpress.org/support/users/keelhauler/)
 * (@keelhauler)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/reverse-order-posts/#post-5944815)
 * It worked, thanks so much. I just needed to read everything more carefully.
 * [http://keelhauler.org/WordPress/?cat=14](http://keelhauler.org/WordPress/?cat=14)
 * But I need to change my picture header again.
 *  Thread Starter [keelhauler](https://wordpress.org/support/users/keelhauler/)
 * (@keelhauler)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/reverse-order-posts/#post-5944821)
 * Thanks again

Viewing 8 replies - 1 through 8 (of 8 total)

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

## Tags

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

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 8 replies
 * 2 participants
 * Last reply from: [keelhauler](https://wordpress.org/support/users/keelhauler/)
 * Last activity: [11 years, 1 month ago](https://wordpress.org/support/topic/reverse-order-posts/#post-5944821)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
