This will definitely work….It worked for me…
$username = get_the_author_meta( 'login', $author_id );
$args = array(
'post_type' => 'any',
'orderby' => 'date',
'order' => 'DESC',
'suppress_filters' => true,
'tax_query' => array(
array(
'taxonomy' => 'author',
'field' => 'name',
'terms' => $username
)
)
);
$query = new WP_Query( $args );
Related Posts:
- Ordering by meta_value AND date NOT WORKING with wp_query
- Orderby ASC changes to DESC in WP_Query
- Complex WP_Query order request: DESC by day, but then ASC by time
- 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?
- 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
- Get Recent Posts by Date in Multisite
- Sorting posts by custom date fields (non standard date format)
- 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?
- 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
- Use meta_query to display events by date in custom field
- How to use order RAND() on WordPress?
- Custom Post order for homepage
- How to show recent and upcoming birthdays using meta_query
- WordPress WP_Query orderby being overwritten
- 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?
- pre_get_posts order by not working
- Comparing dates in custom field
- 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’
- 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)
- 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
- Orderby two meta fields not working
- Sorting posts by Multiple custom fields in defined order
- 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 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
- 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`
- new WP_Query with order args – no more distinction between categories