How to change posts order on Category and Tag archives?

You can use pre_get_posts action to modify this order. Here’s the code:

function my_change_posts_order( $query ){
    if ( ! is_admin() && ( is_category() || is_tag() ) && $query->is_main_query() ) {
        $query->set( 'order', 'ASC' );
    }
};
add_action( 'pre_get_posts', 'my_change_posts_order'); 

What we do here is:

  1. We’re adding our function that will modify params for WP_Queries
  2. We make sure that it will change only main query (the one created by WordPress) and only on category and tag listings ( is_category() and is_tag()).
  3. We change the order of posts for these pages by setting order to ASC