Given your detailed description, it seems you’ve taken several steps to address the issue of sorting your archive pages in WordPress. The fact that changing the “order”:”desc” to “asc” in the archives.html file of your theme didn’t yield the desired result suggests a deeper issue.
Try this in your functions.php file:
function wpb_modify_category_query( $query ) {
if ( $query->is_category() && $query->is_main_query() ) {
// Set the order to ASC
$query->set( 'order', 'ASC' );
}
}
add_action( 'pre_get_posts', 'wpb_modify_category_query' );
Related Posts:
- Sort posts by category name and title
- Query Set Order By Author
- How to orderby meta_value_num with dollar ($) sign
- While creating Block Themes in WordPress, how can I query custom posts for an Archive view?
- WP_query sorting can’t sort danish letters (æ, ø, å)
- Sort WordPress Posts Meta value by Week not Day
- Move some posts to end of sort order, even if there is a sort in the wp_Query already
- Ignoring ‘a’ when sorting posts
- Block Editor – WordPress 6.1 – CPT Archive Issue – While the title changes in the loop, all records display the same data
- Wp get all the sub pages of the parent using wp query
- Usage of the new “posts_clauses” filter in WordPress 3.1?
- Changing the meta_query of the main query based on custom query_vars and using pre_get_posts
- How to uniquely identify queries?
- Get posts by meta data OR title
- WP_Query ordered by custom field that is a date string?
- How to make an activities stream mixing posts and comments?
- Duplicate Queries
- How to query for a week using key => value WP_Query argument notation?
- SQL query equivalent to WP User Query
- How to count post type that has a particular term?
- WP Query by Gutenberg block and get its attribute
- Foreach-generated custom tax queries, each with an ajax “Load more” button
- Sort by meta key on archive page
- meta_query on a date range using an array of values
- WP_Query Performance Issues with meta_query
- How to detect custom query inside `posts_where` hook?
- Is temporarily overwriting $wp_query a bad idea?
- Retrieve or Query Pages by ID
- WordPress: Keep order of query_posts list of post ID’s using post__in
- Using pre_get_posts on a specific core/query block
- How to output different posts per page?
- Pass array of taxonomy terms to wp_query
- How do I sort posts with multiple pages
- merge two query arguments into one WP_Query call
- Using WP_Query in “parse_query” or “pre_get_post” in Posts2Posts
- Query: offset post list, unless it’s a specific category
- How to reduce the number of queries?
- List of the years with posts presented
- Query custom post type by custom taxonomy (category slug)
- Custom Query num_rows returns wrong amount
- Editing the default wordpress search
- How to duplicate 5 posts out of WP_Query results?
- Weird orderby => post__in issue
- Slow page loads due to WordPress Core Query
- Set global $wp_query/$post variable for dynamic page generation
- WP_Query with ‘rand’, but equal number of posts from the taxonomy terms given
- Why does get_posts only show results for Admins or logged-out users?
- Meta Query relation “AND” then set array accordingly
- WP Group posts by year(desc) > month(desc) > date(asc)
- Is_single() conditional tag returns null in query
- 2 wordpress loops showing 1 post from same post type – how to avoid showing the same post?
- Query posts that contain video?
- How to order WP_Query to group results?
- Show a 404 error page if Public query variable’s value doesn’t exist?
- Set front_page programatically after user login via query, while leaving site option alone
- Query where ANDing slug values not working
- How to filter query loop block with a search string from the query parameters
- How to use a dropdown to filter posts by custom field
- mysql query order by
- Notice thrown when creating numeric pagination on custom query
- How to SQL query posts IDs by categories AND authors?
- Query multiple post types, but different order for each
- WP_Query Orderby meta_key and hide some meta_key
- setting offset to category number in archive page
- How to do WP_User_Query for Nested Array value Inside Nested Array field
- Query Posts | Combining multiple form inputs into query arguments to generate one filter result
- How to get_comments() ordered by date and parent?
- Order 2 meta_queries differently in WP_Query?
- How to query 5 users in random who have published more than 10 posts
- Slow wp_posts and wp_postmeta query using Advance Custom Fields
- How to show post title in content editor in backend?
- Adding Category in WP_Query Not Working
- Merge two queries and remove duplicate
- What is the best way to reset a search on a meta_key / meta_value?
- Fetch only categorized posts
- Wrap group of wp query posts to parent div by date/year
- Bring a post to the top of the query if it’s in a certain category?
- WP_Query with child element
- Custom pagination (Title, date and teaser)
- Using URL variables on a custom WP_Query
- Sorting posts by meta values: 2 different orders
- Sort / Filter Queries
- Using WP_Query to re-query and sort results using a date?
- Pagination is not working on custom query inside a custom home page template
- Pagination in custom query in a category page
- Sorting: custom query with orderby meta_value_num THEN by title
- WordPress Query showing multiple titles
- custom query to get posts
- confirm my booking with phone number
- Showing posts from 4 categories along with all latest posts
- shortcode using multiple WP_Query’s with multiple category names not fully functional
- Pagination in WP query with transient API
- WordPress query very slow on +/- 300k DB entries and 7 INNER JOIN
- A Depth Like Parameter For “get_posts”
- Search query alteration not working for meta values
- Search results stuck on page 1
- Use value from meta key array for use in WP_Query
- Sort by multiple columns using get_posts
- Multiple queries and pagination
- Optimizing AJAX Query with Large Database