Did you try this?
function sort_query($query)
if ($query->is_tax() && $query->is_main_query()){
echo $query->query_vars['taxonomy'];
$query->set( 'orderby', 'post_title' );
$query->set( 'order', 'ASC' );
//do other stuff
}
}
add_action('pre_get_posts', 'sort_query');
Happy Coding,
Kuchenundkakao
Related Posts:
- Display all posts in a custom post type, grouped by a custom taxonomy
- Exclude a category from WP_Query
- $wp_query->queried_object->ID throws warning: Undefined property
- Select All in Parent Category, Group by Child Category?
- query multiple taxonomies
- Custom Taxonomy with Custom Post Type Finds No Posts
- The Operator “NOT IN” Does Not Work In tax_query
- Counting Posts of a Given Post Type Having a Specific Taxonomy?
- Custom query – alternate posts by category
- WP_Query -> sort results by relevance (= most tags / taxonomy terms in common)
- How to get_queried_object on multiple objects?
- how to group custom post type posts by custom taxonomy terms
- How to count other posts not having specific taxonomy terms?
- Exclude latest post from WP_Query taxonomy term loop
- How to query Posts from a custom post type which contains a custom taxonomy?
- Query Posts that have Custom Taxonomy
- List all Custom Post Type posts excluding certain Taxnomy term
- Get posts by category name
- Foreach loop returning more than one item when querying taxonomy
- WP_Query order custom post type with certain meta key value by post modified date
- Cant’ Display Custom Post Type Title Base on Tax Terms
- Query custom posts from custom taxonomy
- Loop for custom-post-type comparing taxonomy terms for “related” posts?
- Query Custom Post Type by Taxonomy
- Display featured posts for a custom post type by taxonomy
- Multiple custom post type queries causing wrong post types to be grabbed in taxonomy + single templates?
- Query for specific taxonomy that executes a particular loop depending on volume of posts?
- Related “custom post type” using “custom taxonomy”
- What is the most efficient way to execute recursive complex queries?
- Sorting the Loop by Taxonomy Value
- custom taxonomy pagination 404 error
- Ordering by meta value not working
- set object terms after some some time of published post – functions.php
- Sort custom posts by date and then by taxonomy
- have to do a while have post to show for two custom post types sharing the same taxonomy?
- custom post type and a “sticky” position taxonomy
- Display post count for a specific month
- display post count in archive page that have relation with another taxonomy term
- In child theme, add CPT to custom taxonomy registered in parent theme
- Store a value in global scope after init hook is fired
- Changing CPT permalink
- How to search through all child taxonomies using WP_Query?
- WP_Query to display number of custom post type filtered (order by) taxonomy
- WP_Query for custom taxonomies showing posts from non-specified terms?
- Sort custom post archives by a meta value from a different custom post type?
- Live search by custom tag
- Query a custom taxonomy in a function to create an csv file
- WP_Query based on ‘s’ and tax_queries
- WP_query sort by taxonomy
- Custom Taxonomy – fields
- CPT Loop, include taxonomies and disclude others?
- Ajax load more inside custom post type taxonomy
- WP Query tax_query not returning posts
- Create a custom wp_query from a specific custom post type with specific taxonomy
- The most recent post of custom taxonomy
- Why get_posts() returns empty array while I am trying to get posts from some specific taxonomies and work properly with others?
- Problems with the WP_Query query for a Custom post type
- Displaying WordPress posts from post and custom post type in custom taxonomy
- Display all Custom taxonomy terms and their relevant custom posts
- Get posts of an specific term of a custom taxonomy
- Query pulling all taxonomies, not one I am specifying
- Checking Taxonomy Terms for a Custom Post Type With get_the_terms Not Working
- CPT Efficient way to display posts from different categories with custom query
- Get archive of posts separated by taxonomies and subtaxonomies
- Query Pulling the same post twice
- Custom post type and custom taxonomies display
- WP_Query for CPT with filter by another WP_Query
- Get posts associated with custom taxonomy alternate way
- How to pass taxonomy terms to WP_Query along with $args?
- WordPress custom post type
- Loop with Custom Post Type and Taxonomies
- Custom Taxonomy Query by Taxonomny not working
- How to query posts by meta keys AND under specific category?
- Shortcode display CPT Query only showing 1 post?
- tax_query showing no results
- Post data in separate divs with incrementing class using WP_Query
- Values inside a custom field to determine which category posts to display
- How to display elements of different post types?
- Storing/querying custom date data
- WP Query Post Type with same Taxonomy name
- WP Query WordPress Post Type with the same Taxonomy name
- How to list groupings and keep pagination
- How to retrieve taxonomy terms of the current custom post?
- Listing all custom post types using a specific term on the said term’s template page, in groups
- Catergory args causing loop not to show
- How to Get The Taxonomy Term in Custom Post Type Loop Inside a Wp Query
- display custom post type from register taxonomy
- Attaching multiple custom taxonomies to one CPT?
- Get X posts with the same terms as the current post (custom post type and custom taxonomy)
- WP Query Conditionally query meta and taxonomy
- Sort ACF by custom taxonomy
- Complex Custom Loop with Includes
- Query custom post type and group by taxonomy
- WP Query – Can’t get posts with specific taxonomy
- Dynamically count the number of custom post types associated to a custom taxonomy
- WP_Query not using relation key as expected and not producing any results
- WP Query filtering by custom category not showing all relevant posts
- How to assign a single-menu-template to a menu-items in a taxony/ cat/ subcat/ subcat-item
- Custom fields disappearing when a custom post type is assigned
- wp_insert_term how to insert “” in description