You could hijack the $query
just before fetching the posts.
function wpdev_156674_pre_get_posts( $query ) {
if (
$query->is_main_query()
&& $query->is_tax( 'region' )
) {
// Manipulate $query here, for instance like so
$query->set( 'orderby', 'meta_value_num' );
$query->set( 'meta_key', 'event_date' );
$query->set( 'order', 'DESC' );
}
}
add_action( 'pre_get_posts', 'wpdev_156674_pre_get_posts' );
References:
pre_get_posts
action hookWP_Query
class
Related Posts:
- How do I exclude a custom taxonomy from the post loop
- Display category posts grouped by taxonomy
- display posts with same taxonomy term
- Including all terms in wordpress tax_query
- Display one post from each term in a custom taxonomy [closed]
- Is it possible to sort the post based on a custom field?
- Looping Through Custom Tax Terms and Displaying All Posts For Each
- Group posts that matches a term in a loop
- Custom taxonomy template loop
- How to handle “the_terms” inside loop
- All posts are still shown when adding category argument to query
- Operations with custom fields values in a loop
- echo current taxonomy id for this loop?
- How do I Use Multiple Loops with WP_Query?
- How to adjust code to refresh a dropdown box with tags that are active on filtered category listing
- How can marge these loop code?
- How do I display a list of posts under all hierarchical children of the current taxonomy?
- Posts in loop displaying all taxonomies
- WordPress Tag or Custom Taxonomy Return All Posts if has that Word in Post Title
- where is the 4th taxonomy terms? taxonomy terms is disaapearing in the loop
- Display all posts that use a custom taxonomy
- If Custom Taxonomy
- How can I reduce amount of ifs and else ifs in this specific block of code?
- Returning One custom taxonomy term name
- Exclude taxonomy term from all loops, but having it on widget
- Using WP_Query and Query_post for the loop?
- Loop to display ONLY custom taxonomy parent information [closed]
- Loop through custom taxanomy in post and display custom fields from posts
- List terms of custom taxonomy if matches other taxonomy
- Only display latest custom taxonomy post
- how to get the post id in the option tag
- How to get the term description in a taxonomy term archive query?
- Chaining Taxonomy Queries
- Problem with sorting in custom child taxonomy archive page
- How to add a shortcode function that returns the taxonomy slug of the actual post within the loop
- Group posts in a category based on tags in custom taxonomy
- How to loop custom posts that have an exact match in taxonomy terms?
- Get post meta value outside of the loop
- ACF – Get unique values of array
- Remove Custom metabox from particular page template is used
- Custom taxonomy shows full articles
- Is it possible to sort the post based on a custom field?
- Output slugs to use as class names for every taxonomy a post is attached to
- Multi level archive
- List active taxonomy terms
- sort Posts by custom user filed
- How to get name of custom taxonomy
- Query pages by child term
- Query Number of Loaded Posts in Loop
- Trying to achieve row posts below category with multiple loops in custom tax
- Custom Taxonomy + JQuery Tabs
- WordPress show posts from children terms of a taxonomy term
- Loop custom post type by taxonomy (Category)
- Get custom taxonomy value of post and output posts in same taxonomy
- How do I create a term for every value of a post meta?
- How home my code doesn’t display any feature image? Looping through post from a taxonomy and not getting feature images back
- Loop posts without any taxonomy
- How to looping taxonomy terms?
- Is there a way to ‘Lock’ a Taxonomy?
- get_query_var(‘paged’) always returns empty
- Return only the custom sub-term for custom post type, do not echo term-parent
- wp_insert_term is adding a term that has no name
- Connect Users and Taxonomies
- Retrieving custom taxonomy in order, but excluding specific tax IDs
- Sort Custom Taxonomy Terms in admin by custom order
- Change in custom taxonomy permalink causes 404 error for another custom taxonomy
- Display sub-taxonomies based on SELECTED parent-taxonomy
- Checking if a Page has an Associated Term?
- Get terms ordered by post date
- Custom Taxonomy template not showing
- get_template_part for each level of taxonomy term
- Custom Taxonomies Cababilities
- How to implement custom search with input fields?
- Custom taxonomy [year] is directing to yearly archive
- How to show the a custom taxonomy term on single post metadata
- Sort order by slug for looped child terms of custom taxonomy
- Simple Filter between multiple taxonomys
- Add success message to category add screen
- Prevent users from adding taxonomy terms
- Count Number of Posts in Taxonomy Term in Last 24 Hours
- Changing select options based on previous select with PHP & AJAX
- Headers already sent warning in Admin source is media.php 3140
- Get name of taxonomies of current page
- SQL / wp_update_post: change post custom field to CPT post taxonomy
- How do i display post from a taxonomy term?
- Custom Permalink Structure for terms/taxonomies of custom post type
- register_taxonomy for both ‘Post’ & ‘Page’
- Search custom taxonomy via query-string?
- how do you pull data from two taxonomies?
- problem : Custom taxonomy template not showing
- Display multiple taxonomies in a function
- Exporting Custom Taxonomy Description without Plugin
- How do I display post count of a custom post type with custom category taxonomy in wp_menu_nav?
- WordPress Main Menu with dynamic url
- wp_insert_post and custom taxonomy
- Best Method to Switch Between Terms (Custom Taxonomy)
- Getting the parent terms adds additional empty markup [closed]
- How to query authors by custom taxonomy?
- Using post type archive page for taxonomy archive
- Taxonomy archive link from term id