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
- WP_Query orderby date not working
- Order by optional meta key?
- 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?
- How do I order pages and categories by ID or name in the same query?
- Merge 2 args in one WP_Query and order it by date
- Revolution Slider Orderby Two Custom Fields
- Order posts ascending with number in title
- List taxonomy terms plus their latest post ordered by post date
- WP_Query not retrieving by random order under parent
- 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?
- 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
- Orderby ASC changes to DESC in WP_Query
- Search pages that are a child of the current page
- Get pagination working for custom loops within page templates
- 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
- Weird orderby => post__in issue
- How to order posts by title after they have already been sorted by category
- Advanced ordering of query_posts
- meta_value_num not ordering all items
- Pass $page_id to new WP_Query
- WP Query – order posts by meta field first and then order the rest
- How to Create a Random List of Child Pages
- Specify strict ‘order by’ in WordPress query
- Pagination on template page for custom query redirecting to index.php
- Create a page template for “top rated posts” but show full content and not just a list
- All blog data on a page using custom query gives 404 for page 2 and onward
- WP_Query returns different results from get_posts() [closed]
- When listing child pages run out of memory
- How to generate feed for custom template
- How order posts from category by date and comment count?
- Pagination for custom loop on custom page template is not displaying anything
- Filtering by multiple conditions in the loop
- Get query results with a page title
- Orderby two meta fields not working
- How to get main menu only with wp_nav_menu
- Get list of all Grandchild Pages
- How to get pages of parent (non-recursive)?
- orderby ignored by wp_query
- WP Query and multiple pages
- Page template doesn’t display simple HTML if inserted into other page?
- WP_Query order by multiple meta keys & fields
- Custom order of posts in wp_query and different taxonomies
- WordPress Query custom ordering by temporary variable
- Custom order revolution sliders post base slides as inserted in Specific Posts List field
- WP_User_Query Orderby Not Working
- Query Order By Number Variable From API
- How to get_comments() ordered by date and parent?
- Order 2 meta_queries differently in WP_Query?
- How to exclude posts by ID within a category/archive loop
- Best way to query posts and order by relevancy to query
- Order & Orderby clause not working with custom query
- wp_query sorting – one specific meta_key value at last and then sort by create date
- How to create page that lists tags by initial letter?
- Get a page ancestor from a most viewed list
- Category Archive not working for pages
- Order posts by more than one variable (meta_key and publish date AND time)
- Create custom order sortby based on array of id
- Best way to Order Post in Home without a plugin
- Retrieving category pages from subcategory returns empty sets
- Query All Attachments and Order by Parent Publish Date
- Using URL variables on a custom WP_Query
- Order Custom Field by Price
- Show parent’s child and also child’s, child on a page?
- Order posts by custom column using pre_get_posts
- Add filter to Orderby Parameter using Array
- Pagination is not working on custom query inside a custom home page template
- Order WP_Query results in order other than ASC or DESC
- Show sticky post before other WP_Query
- Custom query to order by multiple taxonomies
- Sorting: custom query with orderby meta_value_num THEN by title
- Get post closest to today
- orderby in WP_query doesn’t works
- Order by meta values
- Get next post when using pagination with WP_Query?
- orderby and order filter in get_posts or WP_query function in wordpress not working
- Why does wp_query only display the most recent post when using order ASC?
- How to put posts with some taxonomy on top of others in `pre_get_posts`
- WP_Query sort by ACF date field (newest first) with blank dates first
- new WP_Query with order args – no more distinction between categories