Basically, when you want get posts, you should think about WP_Query
. It’s already in the docs for your question.
You can get posts by an author like this
$query = new WP_Query( array(
'author' => AUTHOR_ID,
'posts_per_page' => 5
) );
You can even get posts by more than one author, like this
$query = new WP_Query( array(
'author__in' => array( AUTHOR_ID, ANOTHER_AUTHOR_ID ),
'posts_per_page' => 5
) );
Because WP_Query is sort by date and order descending by default so you don’t need specify that information.
Related Posts:
- WordPress: How to get the current logged in author page URL?
- Limit number of posts a user can make per minute?
- Echo Text If User Is Logged in But NOT the Author of post
- Cannot select certain authors for posts after import
- Update post counts (published, draft, unattached) in admin interface
- How to Display a List of Users Who Have Made at Least 1 Post?
- Hook that get’s triggered when the author of a post is changed
- Find out who deleted a page or post?
- the_author() returns empty string
- Prevent Authors from viewing each others Posts
- Display Random Author with Details in Sidebar
- How to show list of posts by author and category?
- How to add editor’s name to entry meta byline?
- Different permalink for posts and authors
- disable password protected page for logged users
- How to display posts by current user/author in a custom page template?
- Query posts distinct authors
- Force “Submit to review” when a post is updated
- Restrict the Number of Posts an Author can Publish (over time)?
- Search posts by post author name
- Get the user type of an author
- Show the title of the latest post by author
- Find most recent authors
- Show author post count in sidebar – Variable
- Get current users post URL?
- Get the author of the latest revision
- Filter posts by author and category simultaneously
- Custom Post Type & Author not associating, user post count is 0, api doesn’t return author in post objects
- Guest Author – How to modify my custom function code if the guest author URL will follow a particular pattern/format?
- Overview with latest edited posts and pages
- Navigation link to specific user page
- Get how many days since last post of the current user
- Post author is changed to admin after his post is modified by admin
- Hide comments awaiting moderation from user who submitted the comments
- Get all posts by post_author
- Query All users that has post
- How can I control multiple editing of wordpress posts?
- Multiple authors for single post without plugin
- How do I allow users to follow a post and then allow admins to email all users who have followed that post?
- wp_insert_post let users post to without login…broke
- Authors in menu, template list post by author
- Get user’s most published categories
- Show the author’s count of total amount of posts assign to a custom taxonomy term
- Author must complete profile info before they can publish a post?
- Allow anonymous users to post to my site for moderation
- WP rest api returns 404 only when author param is used
- How can I list random authors from current post category?
- disable column on post and user list
- how to find user ids of all commenters in a post
- How to list users and their post amount?
- Is there any way to allow users to access content before it’s published?
- UberMenu list current user’s posts as menu items
- Create post for every user?
- How can I show wordpress posts based on author?
- Show info to author only
- count the total number of comments the user has received for his published posts
- Auto “expire” all of an authors posts on spcific date
- How to get the user meta data for a post?
- Limit posts per author role (excluding admin) in home page
- Guest Author – How to display posts on /author/ archive page
- Restrict users post for himself
- How can I show many posts an author has per week?
- How to give capability (publish contributors posts) to author role?
- How to allow logged in users to post anonymously
- Allow public to post on blog
- current post with current author
- Whitelist Author of Private Post
- How to verify wp user password by sql query in wp? [closed]
- Show posts by a custom post author
- How can i delay reading posing in 3days for not logined user?
- Encountering “Wrong nonce. Action prohibitied.” when trying to alter User Role and unable to Post via WP Admin
- Getting the current author (it has changed) of a post, not the original author
- Users problem (multi-author plus multisite)
- Showing author page if user has no post
- Display Notification Bar on Header on Certain Post Count
- How do I manage my users post before publish?
- Gather posts into a cart/lightbox and share with another user
- obtain the author id given the post id
- Show comment number per author per day
- Get all comments of author’s posts
- (solved) getting post author’s user role
- Change all author links in Blog roll
- Display author’s name and avatar in post’s sidebar
- Assign published posts to another user automatically
- Add field to user meta table in database when link is clicked
- Hide comments and posts posted by other user
- Automatically create a default set of posts for each new registered user
- static landing page leading to author specific pages w/ “live” content
- If contributor has published 2 or more posts then show otherwise hide
- All Posts Linking to Author Posts directly
- Summary of Posts by an User
- Change post author without using wp_update_post()
- Display a list of users who have viewed the post you are viewing
- Is it possible to lock all new and existing WordPress posts to one specific author?
- Check if current user has a post and that post has any term/s from a specific custom taxonomy outside the loop
- How to get the ability to change the author of a post
- Deleted a user with administrator rights. Now all the data/content/images are lost. how to recover them back
- Only allow posts with a specific term to only be viewed by other authors with the same term in their post
- How to limit author related post listing ?
- Restrict displaying posts to the poster itself (in Back-end)