I’ve assumed that since the posts have already been returned then I
should use ‘query_posts’ to alter the order of the posts.
That assumption is wrong. You should pretty much never use query_posts
.
Use a filter on pre_get_posts
.
function pregp_wpse_108235( $qry ) {
if ( $qry->is_main_query() && $qry->is_tax() ) {
$qry->set( 'order', 'ASC' );
}
}
add_action( 'pre_get_posts', 'pregp_wpse_108235' );
But that completely destroys the original list of returned posts and
replaces it with regular posts.
Yes, what you did would return the normal post index. You did not supply any of the taxonomy arguments, but as query_posts
is the wrong way to go anyway there is no point in worrying about that.
Related Posts:
- Link to most recently created category of custom taxonomy in primary navigation menu
- Sorting Posts Via Custom Taxonomy Values Using Checkboxes?
- query_posts and custom taxonomy posts order
- How do I exclude a custom taxonomy from the post loop
- Filtering custom taxonomies
- Using WordPress to make a “Product Search” type navigation drilldown
- Custom Taxonomy not working with posts_per_page in new WP_query (pagination problem)
- get_query_var(‘paged’) always returns empty
- Custom order of terms for custom taxonomy in admin and website
- How can I set a default listing order on the admin page for a custom taxonomy? (without plugins)
- search query within custom taxonomy term, post title and meta field
- Sort posts by number of matched terms
- Showing posts by collection of specific terms and texonomy
- Problem with query_posts for a custom taxonomy in theme options
- How to display posts from a single category within a custom taxonomy
- Advanced Tax Query
- Last posts from custom taxonomy
- Taxonomy.php issue with search and filters
- Sort custom taxonomy terms order by both count and name
- How to show the entries in a custom taxonomy by author?
- cannot get multiple loops using tax_query
- quey posts from different categories with taxonomy
- Show all taxonomy’s terms’ posts having another taxonomy’s term in common
- Sorting Custom Posts on Archive page with pagination
- WordPress Custom post query sorting does not work
- List Posts For Terms Of A Custom Taxonomy For Any Post Type
- Using WP_Query and Query_post for the loop?
- How to write sql query to get the posts from a custom taxonomy term name
- one post per term taxonomy
- Loop through custom taxanomy in post and display custom fields from posts
- Sort and paginate custom post taxonomies alphabetically
- Insert taxonomy slug into loop class
- Sort taxonomy page alphabetically by meta rather than default post date
- Using Custom Taxonomies to organise products – struggling to call a correct list
- Sorting the Loop by Taxonomy Value
- Group posts in a category based on tags in custom taxonomy
- Listing Cities A custom taxonmy by selection order
- WP Tax query & order by tax query not working
- Group & Sort Taxonomy terms by letter – Is there a better way?
- sort Posts by custom user filed
- Transfer taxonomy to custom field
- How do I query multiple specific posts from a custom taxonomy?
- Can you orderby slug in a taxonomy archive page using WP_Query?
- query posts returns 10 records
- Getting taxonomies specific to categories
- How much worse is querying custom fields compared to custom taxonomies, quantitatively
- Group custom taxonomies based on tags contained in their posts
- How to show to show post list under the specific category name using jetengine query?
- Custom taxonomy with custom meta value is not sorting correctly (query returns the same value for orderby regardless of sort column click)
- WP REST API no longer supports filter param, so how do I get posts in a custom taxonomy?
- Include and Exclude Taxonomies From Archives & Feeds Using ‘pre_get_posts’
- Get value in custom field with taxonomy [closed]
- Get second level terms of custom taxonomy
- Modify Term Update Redirection
- How to get first post in a category of a custom taxonomy
- How to get the singular name of a custom taxonomy?
- Archive template for taxonomy terms
- pre_get_posts OR relation between taxonomy and author
- Custom Fields and performance
- get_the_term_list without specific category
- Add Category Name to REST API
- Display the Terms from a Custom Taxonomy Assigned to a Post(inside the loop) in Hierarchial Order
- drop-down list taxonomy problem
- How do I get WordPress URL rewrites into Sitemap?
- Programatically added attribute, set to ‘show on product page’ automatically. Woocommerce [closed]
- Get Current Custom Taxonomy ID by Post ID
- Custom fields to taxonomy
- Correct way to insert taxonomies on page insert
- Styling Taxonomy Terms Individually
- Get terms cross-taxonomy query
- How to have two different versions of a tag/category/taxonomy archive page?
- Rewrite Rule Working for all but one of the taxonomies created
- Get custom taxonomy for visual composer shortcode but not working?
- Multi-select field for Taxonomy can’t save the value
- How to Display a menu only if it has Posts in Custom Menu?
- how does the wordpress rest API work
- Why is flush_rewrite_rules mandatory after registering custom taxonomies?
- tax_query not working
- Control content before and after custom post type loop
- wp_query not resetting, last post hanging
- Set term on an attachment using wp_set_object_terms and want to display the full term text but it’s showing a slug instead
- how to get term id from current post type instead of name
- Display children category images
- Dropdown taxonomy lists in admin menu
- How to define %category% for custom taxonomies?
- How to Create Multi selection search Form using Default WordPress Category Terms, and Custom post Types Taxonomies Terms?
- How do I get the correct URL?
- Query all images with certain tag in media library using visual portfolio plugin
- Problem with wp_list_category with custom taxomy
- Restrict viewing of posts by category, user role
- Custom order of taxonomy using wp_get_object_terms and woocommerce_term_meta
- Does a codex exist for creating meta boxes in taxonomy
- Run next query based on first query’s term
- Get the original menu item name string instead of the label
- How to use tax_query other than by slug or id or solve custom taxonomy tags conflicts with pre-existing tags?
- How to query posts that are not related to any term of a taxonomy?
- Function code problem
- add_action with variable as a part of the $tag string
- How to display Custom taxonomy on custom post listing page [duplicate]
- Hook function when taxonomy terms change