If you want to filter the query for a taxonomy archive, you should check if the query is for that archive:
if ( $query->is_tax( 'book_cat' ) ) {
$query->set('orderby', 'meta_value');
$query->set('meta_key', 'published');
$query->set('order', 'ASC');
}
Related Posts:
- How do I query a custom post type with a custom taxonomy?
- how to group custom post type posts by custom taxonomy terms
- Posts per Page on custom Taxonomy Template
- How to get the parent’s taxonomy?
- Query posts by custom post type and custom taxonomy
- How to get only one category of custom post type?
- pre get posts changing the query
- Query for posts in 2 taxonomies
- ‘category__and’ for custom taxonomy?
- Separate Posts and Custom Post Type in Custom Taxonomy archive template
- How to dynamically build a multiple taxonomy query loop within a post type’s single loop?
- List custom post type by custom tax term as page title
- how can i get posts from custom post type particular taxonomy category
- How to query custom post types posts filtered by multiple custom taxonomies through a form selection
- Query/list all terms and their custom post count
- Archive for custom taxonomy lists all posts instead of current taxonomy
- How to use custom taxonomies to reference complex relationships?
- Query Custom posts of same taxonomy as the post itself
- Conditional Query of Custom Post Type and custom taxonomy
- Show a Category X’s custom post type on Category X archive page?
- How to edit this code to get the categories in achieve page?
- Listing all term items alphabetically / sorting loop
- How to display Related Posts based on number of taxonomy terms matched
- How to make WP_Query not to show irrelevant posts?
- Custom query – get_the_terms not work
- Control content before and after custom post type loop
- Custom post type, custom taxonomy, query posts only from taxonomy (children of)
- Display custom posts randomly in custom taxonomy archive
- Not able to export large no. of posts in csv
- attach CPT data to a taxonomy
- List all posts in taxonomy term
- Query Multiple Custom Post Types & Exclude a Taxonomy Term
- Sorting the Loop by Taxonomy Value
- custom post type and a “sticky” position taxonomy
- Posts per Page on custom Taxonomy Template
- Getting Custom Posts with Custom Taxonomy
- WordPress custom post type
- Display 2nd category, only once, as sub-heading, in the loop
- Advanced Custom Fields: query posts filtered by multiple field values
- Inserting two categories
- Why does my custom taxonomy show a total count across all post types
- Custom Taxonomy’s Label to change the text appearing in Appearance > Menu
- Custom Post Type with Nested Taxonomy and Template Files
- order by meta_value serialized array
- 404 error PageNavi custom type taxonomy | wordpress
- Custom post types – show specific posts
- custom taxonomy archive by year
- Add nonexisting pages to navigation
- Multiple post type queries (with specific arguments for each)
- Can custom taxonomies items have attached properties?
- Associate custom post types with normal posts
- WP 3.0.5 – Custom posts matching 2 taxonomies
- Custom Post Type Loop within Shortcode
- How can you handle rewrite rules for custom post types with option to filter on custom taxonomy terms?
- How do I make a custom taxonomy for a CPT appear inbetween title and editor boxes?
- Query with no terms uses index.php template instead of archive.php
- custom taxonamy and post type
- custom-taxonomy/post_name instead of the default post_type/post_name
- Getting categories of posts under a custom taxonomy
- Add term to custom post type on draft
- Multiple tag cloud filtering
- Custom Post Type Category Link
- Custom Post type category pages template and loop
- Show all tags on custom post type
- How to rewrite custom taxonomy term archive to use THE SAME SLUG/front as CPT
- How to get the post terms from a child taxonomy
- Custom Post Type View Button in Admin Gives 400 Error
- rewrite rules hierarchical
- either single-{custom}.php 404’s OR /taxonomy/ 404’s – custom post type and taxonomy permalinks
- Custom Post Types Not Showing Up In query_posts Result
- How do I set a post slug automatically based on taxonomy?
- Get a list of custom post type (property) when clicked on custom taxonomy 1 (rent or sale) from custom taxonomy 2 (city) page
- How to divide Subcategories into pages of parent category wordpress
- update custom taxonomy custom fields
- Filter taxonomy by CPT
- How to display “META” array in register_taxonomy
- If ACF Post Object post has custom taxonomy term…
- Customise Permalink Structure For Custom Post Types
- minimize wp_query call to database
- How to filter taxonomy of a custom post type and display it in the single post type page in the back end?
- Parent and child categories with their id in drop_down in CPT
- Custom post type post_type_link gives “page not found” on any other custom post type
- Taxonomy’s title
- Display all posts from single taxonomy term
- Best way to use Category & Custom Fields?
- Plugin Error on activating
- Paginate custom taxonomy category with wp_custom_pagination
- Custom post type post taxonomies
- If taxonomy show class of active
- Storing/querying custom date data
- Custom Template Taxonomy
- Query Posts From Multiple Post Types
- WP Build-In Post selector for CPT
- How to relate one custom post type to another custom post type
- Issue On Listing Woocommerce Parent Tag List
- show custom post’s post in two different divs [duplicate]
- Rewrite Rule for custom post type link with or without taxonomy terms
- How to add to taxonomies to a post type
- Filtering custom post types using category taxonomy
- How to use wp_set_object_terms depending on page ID?