Your code is invalid (syntax error, missing closing array and semi-colon), and incorrectly nested – if you were to properly indent your code, you’d have something like:
$args = array(
'tag' => 'tag-AAA,tag-BBB',
array (
'orderby' => array(
'title' => 'ASC',
'post_date' => 'DESC',
)
),
);
See how orderby
isn’t actually a property of $args
? You need:
$args = array(
'tag' => 'tag-AAA,tag-BBB',
'orderby' => array(
'post_date' => 'DESC',
'title' => 'ASC',
),
);
I’ve also switched the order so that posts are ordered first by date, then by title.
Related Posts:
- How to display page content in a page template?
- Single page theme that uses pages for the content
- Trying to list out child pages with WP_Query
- Order by menu structure
- What are the differences between “Latest Posts” and “Static Page”?
- How to use custom page for all posts with custom url, call another directory?
- How can I use a specific wordpress page template if certain words are used in page title [closed]
- WordPress pagination returns the same posts
- Page template query with WP_Query
- Ignoring initial articles (like ‘a’, ‘an’ or ‘the’) when sorting queries?
- WP_Query orderby post__in remains ineffective in the Loop [closed]
- WP_Query orderby date not working
- Order by optional meta key?
- Sorting: custom query with orderby meta_value_num THEN by title
- Order by DESC, ASC in custom WP_Query
- WP_Query order by multiple meta keys & fields
- Secondary Sort (fallback) for WP_Query
- Query Posts in a Predefined Order
- How to get order of posts?
- Order posts by ID in the given order
- Custom WP_Query order by post_meta and (author) user_meta
- Sorting posts by custom date fields (non standard date format)
- Does WordPress generate an automatic page for post formats?
- How to order posts tag by tag?
- How do I order pages and categories by ID or name in the same query?
- WP_Query ordered by custom field that is a date string?
- 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
- Order posts by date and then by custom field
- How to order a post type with meta_value_num and if meta_value_num does not exist then order by date
- Revolution Slider Orderby Two Custom Fields
- Single page theme
- Order posts ascending with number in title
- List taxonomy terms plus their latest post ordered by post date
- Order by the results of a function with WP_query
- How to order posts in wp_query by a meta_value of the corresponding author
- Front End Sorting Questions
- Targeting specific pages in the loop
- WP_Query order by date in meta_value
- How to use order RAND() on WordPress?
- Show all parents and children in custom post type in right order
- Ordering by meta_value AND date NOT WORKING with wp_query
- WP_Query orderby breaks when using AJAX?
- WP_Query not retrieving by random order under parent
- Order WP Query posts by custom order calculated from post meta values
- Custom Post order for homepage
- Meta query with order by another custom field
- Change default ordering of taxonomy terms – pre_get_terms
- WordPress WP_Query orderby being overwritten
- WP_Query Order by Specific Post ID First
- Order Posts by meta value AND published date
- How can I pick a single post from the latest 3?
- Wp query orderby ‘title’ doesn’t work
- WP_Query doesn’t get sticky post at the top, when used in a page template
- How can I order Wp_Query hierarchically?
- How do I sort posts with multiple pages
- Sorting posts DESC based on the number of comments using WP_Query
- Order WP_Query by multiple fields, subtracting them from one another
- Complex Orderby Parameters: How to query with multiple orderby parameters using meta_value_num?
- pre_get_posts order by not working
- Set if condition with wp_nav_menu
- Set order of returned items in the WP_Query() class/function
- Pagination of a WP_Query Loop in a child-page page template
- list pages using page.php and NOT page-{slug}.php
- (Solved) WP_Query ($ args) -> How to sort letters and numbers within the same array
- Orderby ASC changes to DESC in WP_Query
- SQL: What is wrong with the following query (generated by WordPress WP_Query, ordering prices)
- Order By table field comment_status in WordPress > 4.0
- Search pages that are a child of the current page
- Get pagination working for custom loops within page templates
- Complex WP_Query order request: DESC by day, but then ASC by time
- How to set multiple `orderby` in query argument?
- WP_Query order result by date AND meta_value
- How to display summary content from a Page (Not a Post) on another page
- Order by title without taking into account ‘the’
- How is WP_Query parsed to determine which template to request?
- Serve specific “template” page at any URL that ends in its slug
- WP_Query orderby author__in
- WordPress Pagination changes my template
- How to orderby multiple meta fields if some fields are empty
- Sort wordpress custom posts based on meta value
- WP_Query: Group events by year, sorted DESC; then by date for each year group, sorted ASC
- Weird orderby => post__in issue
- Order by summing multiple values
- Understanding the orderby in WP_Query?
- Order by empty custom field
- add_filter(‘query_vars’) not working in custom template
- 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
- Order ascending is ignored in meta query?
- meta_value_num not ordering all items
- Display custom tags on pages that have a specific page parent
- How to filter a query by multiple meta keys and order by other meta keys
- Is there a reason why Pages are not publicly_queryable?
- Multiple Orderby’s using random order WP_Query
- Why post__not_in is ignored?