If you just want to return published posts, you can exclude the ‘post_status’ argument as by default it will just return published posts only.
Having said that, the array works for me too though.
Related Posts:
- get_next_post() not working with future post status
- Get Posts Under Custom Taxonomy
- How to show related posts by category
- How to Display a List of Users Who Have Made at Least 1 Post?
- get_children() Not Working with orderby Parameter
- How to get all posts related to particular category name?
- Let private posts stay in status “private” after edit through “editors”
- How to know if get_posts() failed?
- How to display posts by current user/author in a custom page template?
- Show the title of the latest post by author
- featuring old articles without messing up with the archive
- Setting pagination for images attached to a post
- Query only Posts from Both of Two Category?
- Enable commenting on front-end preview page for pending posts
- WordPress get posts by date without query_posts
- How can a guest view the “Pending Review” Post?
- Posts are not showing up on particular category
- How do I batch create revisions of all posts?
- get selected post using $_GET
- ‘transition_post_status’ only fires when pressing “Add New”
- How Can i Get 5 Recent Post Title With Corresponding Link?
- Can I set and show “important” post in my blog?
- setup_postdata doesn`t seem ot be working
- Get Posts via Taxonomy Term Name with Space
- Get specific posts by ID in wordpress
- Automatically republish old posts
- How can I set a Post’s default visibility to private and pending review checked
- get_next_post() and get_previous_post() return wrong posts
- Get posts by name and taxonomy term
- Inserting custom data to the_post() during loop
- How do I restart my loop with get_next_post()?
- Get mixed category random posts
- WordPress not opening posts with only numbers if permalink is post_name
- Limit popular posts by days
- get_the_content(“more…”) returns full text
- How to change post status from frontend?
- Insert Content In Between Post Feed
- Post Loop Missing Most Recent Post
- Get Posts Under Custom Taxonomy
- Posts and Attachments with “Published” status in Search
- Pagination with an array of post objects?
- Restrict edit, but allow preview for custom post status
- Posts loop displaying the same post data
- How to get posts from a current post’s month?
- How to get posts and comments amount per hour, per year and per month?
- While loop articles – if statement order
- Count number of posts of current month
- why there are so many posts whoes post_type is revision? will these records waste too much database space?
- How to Get Posts, Including Private Ones?
- Random posts from a pool of posts
- Conditional Tag for has post [closed]
- Display Posts with template on a Page
- Why posts array is empty?
- How to create a “latest news” page showing a list of posts from blog category
- Post Filtering by GET URL parameters
- Custom Articles page only showing a limited number of posts per page
- Related Posts function not working
- How to get post with slug and exclude categories
- What function publishes a post when you click the publish button?
- Get x recent posts by author?
- Post Status Frontend Announcement
- Display amount of pending posts in back/front end
- If post does not exist, do something
- Internal linking to posts permalink fail because of spaces and stripe at postname
- Get posts from current category?
- How to add content above footer in posts from specific category
- How can I restore posts from ‘trash’ with their previous post_status? – WordPress
- I need to create “View Profile” and “Edit Profile” links by incorporating the Post Title/ID, but can’t seem to manage it
- How to merge the content of posts that have the same title?
- How to add first 3-4 post tags on WordPress Post Title
- get posts, run a custom query, and join the results
- How to set a Post’s default visibility to ‘Private’ in Gutenberg?
- Updating post status via rest api
- How to mark only one post as Featured post?
- Hide or remove custom post status
- Extracting the permalink from a post instance
- REST API Working for GET but not for POST?
- Fill the exclude array() in get_posts()
- Posts page listing pages as well
- How to add navigation arrows to manually slide through posts?
- Modify loop to include all post statuses not just ‘published’
- How to convert return type of ‘get_posts()’ same as ‘wp_get_recent_posts()’?
- How to get all posts in gallery post format template
- How to get the current user post and it’s ID?
- Function/filter or plugin to change post status based on custom field value
- Retrieve latest post by multiple categories with ID
- External link not showing on post but showing on comment
- How do I paginate posts page with $wpdb?
- How to get all post titles starting with numbers and symbols?
- Bulk Attach Or Insert Media To Post Without Opening Post Editor
- Displaying posts on Homepage
- How to get single post by one author?
- Load posts from external source if not found in database
- I am creating a front end dashboard where I need to show all the posts by the current user. So, I need to show posts in publish
- wordpress show category link instead of post link [closed]
- posts_per_page – Repeats only first posts ‘post__in’ array
- Post Format Status [closed]
- append $_GET parameters to post
- NewsPaper WP Theme – Additional Related Posts Filter by Time (divTag composer)
- View post with specific category id and name which I selected in the backend (drop-down option)