You’re not using query_vars
quite right – this filter is for whitelisting “public” query vars, not actually setting their values. It’s also called rather early (wp::parse_request
), so any conditional tags like is_tax()
will always be false at this stage.
Use the pre_get_posts
action for overriding the default query. Having said that, you need a custom ORDER BY
clause. Use the posts_orderby
filter:
function wpse_179686_posts_orderby( $orderby, $wp_query ) {
if ( $wp_query->is_main_query() && $wp_query->is_tax( array( 'series', 'speakers', 'topics', 'venues' ) ) )
$orderby = 'DATE( post_date ) DESC, TIME( post_date ) ASC';
return $orderby;
}
add_filter( 'posts_orderby', 'wpse_179686_posts_orderby', 10, 2 );
Related Posts:
- WP_Query orderby date not working
- Ordering by meta_value AND date NOT WORKING with wp_query
- Orderby ASC changes to DESC in WP_Query
- WP_Query: Group events by year, sorted DESC; then by date for each year group, sorted ASC
- Get post closest to today
- Get posts that were most recently tagged
- WP_Query sort by ACF date field (newest first) with blank dates first
- Ignoring initial articles (like ‘a’, ‘an’ or ‘the’) when sorting queries?
- Order by optional meta key?
- Sorting: custom query with orderby meta_value_num THEN by title
- WP_Query order by multiple meta keys & fields
- How to get order of posts?
- Order posts by ID in the given order
- Get Recent Posts by Date in Multisite
- Sorting posts by custom date fields (non standard date format)
- WP_Query sort by comment meta data
- Order posts by tags count?
- Merge 2 args in one WP_Query and order it by date
- Orderby = none not working [duplicate]
- WP_query ‘orderby=none’ Problem
- Revolution Slider Orderby Two Custom Fields
- Order posts ascending with number in title
- Date query not inclusive despite parameter being true
- Use meta_query to display events by date in custom field
- WP_Query orderby breaks when using AJAX?
- Custom Post order for homepage
- Change default ordering of taxonomy terms – pre_get_terms
- How to show recent and upcoming birthdays using meta_query
- WP_Query Order by Specific Post ID First
- Order Posts by meta value AND published date
- Sorting posts DESC based on the number of comments using WP_Query
- WP_Query meta_query >= date
- Complex Orderby Parameters: How to query with multiple orderby parameters using meta_value_num?
- (Solved) WP_Query ($ args) -> How to sort letters and numbers within the same array
- How to set multiple `orderby` in query argument?
- WP_Query order result by date AND meta_value
- Order by title without taking into account ‘the’
- WP_Query orderby author__in
- Weird orderby => post__in issue
- Order by empty custom field
- How to order posts by title after they have already been sorted by category
- Advanced ordering of query_posts
- Help ordering Post loop by two meta values
- meta_value_num not ordering all items
- Taxonomy and Date in same query?
- Shortcode for latest -not expired- posts
- date_query seems to be ignored by wp_query
- WP Group posts by year(desc) > month(desc) > date(asc)
- WP Query – order posts by meta field first and then order the rest
- Ordering posts by an array
- How to Create a Random List of Child Pages
- WordPress Custom Search Form Displaying Unexpected Results
- Specify strict ‘order by’ in WordPress query
- Order is breaking wp_query
- Filtering posts by archive showing all years
- How order posts from category by date and comment count?
- Child pages not affected by orderby
- Ordering posts by custom field and grouped by month
- WP_User_Query orderby meta_val_num
- WP_Query custom order and pagination
- Show single posts date, in a page of posts
- Sorting posts by Multiple custom fields in defined order
- Added Date Filter To Popular Posts Query
- Sort posts using multiple custom fields and menu_order in single query?
- WP_Query order by multiple meta keys & fields
- How to sort wordpress posts already selected by WP_QUERY
- Custom WP Query order function possible?
- Custom order of posts in wp_query and different taxonomies
- Custom order revolution sliders post base slides as inserted in Specific Posts List field
- WP_User_Query Orderby Not Working
- Order by value of Custom Field using url string
- Order posts by tags count?
- Order Element By Custom Field in WordPress
- Query Order By Number Variable From API
- Order 2 meta_queries differently in WP_Query?
- Sorting with meta_query and multiple, optional meta keys
- WP_Query: custom orderby (not ASC nor DESC)
- Order & Orderby clause not working with custom query
- Best way to Order Post in Home without a plugin
- orderby in WP_QUERY – Use the order from the Dashboard
- Query All Attachments and Order by Parent Publish Date
- Using orderby with 2 meta keys
- Order posts by custom column using pre_get_posts
- Add filter to Orderby Parameter using Array
- Order WP_Query results in order other than ASC or DESC
- Custom query to order by multiple taxonomies
- Year based WP Query
- Sorting: custom query with orderby meta_value_num THEN by title
- query_posts with sorting on a custom datestamp
- Query custom post type by date field only working when two posts match the query
- Get posts from similar time as current post
- Divide WP_Query posts by date & post type
- orderby in WP_query doesn’t works
- Query Posts by date range with fixed beginning and end
- Issue with sorting by post date and custom post type
- Posts2Posts, wp_query and orderby issue
- Order by meta values
- Change posts archive ordering
- orderby and order filter in get_posts or WP_query function in wordpress not working
- How to put posts with some taxonomy on top of others in `pre_get_posts`