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
- Transient api Caches confused
- How can I override one post and make it display content for another post?
- Include current post into loop
- Is it possible to query from external database? [duplicate]
- Can’t sort custom post type by random
- pre_get_posts – Trying to get property of non-object warning
- Query posts that contain video?
- Get multiple users with meta value in one query and populate WP_User class
- WordPress query posts with multiple post_meta data
- How to order WP_Query to group results?
- Filter post query to only show direct children of category
- I am having problem sorting custom post type using WP_Query
- Get a list of posts by specific category
- Show a 404 error page if Public query variable’s value doesn’t exist?
- How to check the array values, what WP_Query has brought to me?
- How to set up hierarchical relationships without using plugins / meta query
- How to add custom meta to ‘pre_get_terms’?
- Set front_page programatically after user login via query, while leaving site option alone
- Shortcode for custom query not returning results when attributes are added
- Should I reset $wp_query?
- Yoast primary category query modification
- Query where ANDing slug values not working
- Is it possible (and how to) query single Gutenberg blocks?
- How to filter query loop block with a search string from the query parameters
- Update query for wp_posts and wp_postmeta
- Sorting search results with custom dropdown
- Get specific ACF key and value from all posts – no access to DB
- How to use a dropdown to filter posts by custom field
- mysql query order by
- Display all posts in a custom post type, grouped by a custom taxonomy. How to sort the posts alphabetically and the terms by ID?
- Need help understanding this WP Query [closed]
- Notice thrown when creating numeric pagination on custom query
- wordpress udpate query not equal to
- How do I sort this custom list of sticky posts
- Is it possible to retrieve posts depending on meta_key LIKE condition? [duplicate]
- WP Query and date format
- Write WP Query that selects posts that are part of the same two categories
- WP_User_Query orderby meta_val_num
- WP_Query custom order and pagination
- How to SQL query posts IDs by categories AND authors?
- Unable to paginate a custom page query
- Include one page/post into query which is already returning posts
- I am officially missing something about transient posts
- Insert images into wordpress post with a query
- Why doesn’t my WP Meta Query return any results?
- WP_Query meta compare must include ALL array values
- How to sort queried pages by an array of page ids?
- Start Query from 2nd Post without offset
- Disable (or limit) queries when certain content (or data) is not needed (or showed)
- Display upcoming events in the next 30 days by querying posts with timestamp in custom meta
- orderby ignored by wp_query
- Prioritising and Ordering Posts By Category Name Using A Custom Loop
- meta_query where the meta value is not the post title
- Post incorrectly excluded when using “category__in”?
- Query multiple post types, but different order for each
- Multi-layered WP_Query
- `offset` WP_Query argument dont work via `pre_get_posts`
- Filter products on category AND tag
- Display posts ONLY from the current logged in user and current week/year/month Elementor posts
- WP_Query Orderby meta_key and hide some meta_key
- Customize the Sorting Dropdown in WooCommerce use another list or more page
- Pagination of custom page with custom fields query
- Order (by ASC) posts with meta_key so posts without values are last
- Query pages created by deleted users
- How to sort store location by specific category order in WP store locations
- how to include orderby value that is empty?
- How to sort wordpress posts already selected by WP_QUERY
- setting offset to category number in archive page
- Woocommerce Get Orders By Meta Value
- Sort by price wpdb
- Custom Woocommerce Product Query
- Any way to use FETCH_KEY_PAIR with $wpdb?
- pre_user_query vs pre_get_posts
- Exclude post from wp_query based on custom field boolean
- How sort products by calculate value? ( custom post meta, price, option)
- How to do WP_User_Query for Nested Array value Inside Nested Array field
- Get posts that match defined arrays of tags
- Doing $wpdb->get_results returns NULL, doing the same query in my DB returns correct value
- Get authors list and sort them by recent posts
- Adding nofollow to all the post links in get_posts with pre_get_posts or WP_Query
- Meta query orderby meta_value_num sorting by role first
- How to get meta key list efficiently?
- Order by value of Custom Field using url string
- Order posts by tags count?
- Query against multiple locations within single custom post type post
- Why pagination is not working with tax_query param?
- WP Query with meta queries
- Query Posts | Combining multiple form inputs into query arguments to generate one filter result
- Strange results from WP_Query
- Is there a way to control both Order By and Order query parameters from one input field
- How to get_comments() ordered by date and parent?