Wp Order Archive Page Post By Title

// Sort All Tours by Title
add_filter( 'parse_query', 'sorting_archives' );
function sorting_archives( $wp_query ) {
  if (is_post_type_archive( 'tour' ) || is_tax()) {
    $wp_query->set( 'orderby', 'title' );
    $wp_query->set( 'order', 'ASC' );
  }
  return $wp_query;
}

Leave a Comment