There is nothing in the codex that would suggest that get_post()
would not work with drafts.
if you experience otherwise, try get_posts()
with the include
or post__in
parameter.
Also see the supported type and status parameters here.
Related Posts:
- wp_posts table: safely remove unused columns to save database storage
- Is it possible to use WP_Query to only pull posts with attachments?
- How Can I Always Display A Particular Post First Using WP_Query?
- Where is the old post permalink slug stored?
- The next_posts_link() works only with original $wp_query
- Adding additional data to WP_Post object
- Query *only* sticky posts
- Skipping first 3 posts in wp query
- Accessing the post content with WP_Query
- How are terms connected with posts in database?
- Moving WordPress to new server: no posts found
- Get only modified posts
- How to output comments number of a post per day?
- Should ‘setup_postdata()’ be reset with ‘wp_reset_postdata()’?
- Sanitizing `wp_editor();` Values for Database, Edit, and Display
- If specific user role then sticky post
- Display posts with comments closed, with pagination?
- posts_per_page doesnt work
- I want to query posts in monthly basis
- Reset/Reorder posts ID in the MySQL wp_posts table
- Custom WP_QUERY $args
- Improving WP_Query for performance when random posts are ordered
- Why won’t my taxonomy query show up?
- Limiting the number of posts in WP_Query leads to unexpected result
- How to delete all the content of a wordpress site without deleting the Post and pages?
- WP_Query with ajax handler returns the same posts
- Why WP_Query(‘showposts=5’) shows only 1 post?
- How to insert 2 args into 1 Wp_Query for a slideshow
- WP Query – Posts Per Page not working in combination with category__in
- How to do set post permalinks using 6 digit random unique function?
- how to change the number of posts returned in a specific loop without making it global?
- posts_per_page option limits the number of Gallery items
- Anyone know why wordpress converts some html entities to their numeric equivalents?
- What happens if I delete all the rows that represents a post revision from the posts table into WordPress database?
- Nested WP_Query breaking loop
- Why Query is returning empty array?
- Get posts and include taxonomy term
- meta_value timestamp older than now
- Get posts with multiple categories
- Do not show children of a category
- Add field to user meta table in database when link is clicked
- Query for first 3 posts to change the look and feel
- Getting blog pagination to work on page set as front page
- search blog posts by author first name and or last name
- Delete post revisions only for a single post
- On what hook can I get the queried object’s final state?
- unique post in “$args” of wp_query display more than one post
- Display current post position in Elementor Posts widget
- How to give classname to post if post has no content?
- Custom wp-query in wordpress rest api
- Saving Post Data in Another Database
- posts_per_page returning only one post
- Need to know custom code to display random and most viewed posts in wordpress posts and pages
- How to retrieve certain number of images from a wordpress post?
- WordPress post filter menu
- How to display post list in a table layout (multiple queries in single loop)
- Restore woocommerce orders
- Not all posts showing in query
- WP_Query custom field pass the post id
- WordPress query portfolio posts
- Current and next month posts
- Get latest author posts inside the loop
- Same post appears in related Posts?
- Import custom database into wp and keep the post id
- Display 3 posts with different HTML markup using a loop
- Moved to a new server, backup was a day old and missing 3 posts, anyway to recover them from old host?
- How can I globally italicize list of texts in the UI database or Posts? [closed]
- How to show multiple posts thumbnail, title and date in widget
- Group first, 2nd, 3rd, etc posts by category terms
- Manipulated offset and pagination, can’t display last post anymore
- Function is printing twice – any suggestions?
- How to display particular set of wordpress post on a webpage?
- How to use two query result together in one loop
- show loop id post , only first id can read
- filter posts based on menu_order
- Show 5 posts and than 3 posts offset with pagination
- how i show manual data in a post
- Change archive results based on GET request
- Wp_query loop is not working as it should
- Show all posts from the tags without having to set all of them
- Maximum number of posts per page before affecting performance?
- Is it possible to query a category with specified posts?
- Is there a global page/post/product/anything ID?
- WordPress loop uses unmodified posts array, why?
- wp query custom orderby not custom field
- Converting Posts to Pages
- Show posts between two Custom Fields date
- WP Query between posts custom fields [duplicate]
- Query to get data of a post, if in category?
- Order posts by custom field
- Why I have this strange behavior when I try to exlude the featured post from posts visualization?
- How to change the publishing date of each posts?
- Remove duplicated posts in the loop if post has more than one category
- Why I getting only 1 post?
- The next_posts_link() works only with original $wp_query
- Load posts from external source if not found in database
- Limit amount of pages shown in pagination within wp_query
- First post in loop displays twice
- How can I merge a several related posts into one post?
- date_query returning only the most recent post instead of the post published before today