Opened 15 months ago
Last modified 14 months ago
#20105 new defect (bug)
When inserting a draft post with wp_insert_post you can't query it on name
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | Awaiting Review |
| Component: | Post Types | Version: | |
| Severity: | normal | Keywords: | reporter-feedback |
| Cc: | markoheijnen |
Description
When creating a draft post with wp_insert_post you can't query it with get_post.
In my case I used the argument: name. That is the problem. Not using it will find the post.
I'm not sure if this is an expected result. I would say no.
Change History (2)
comment:1
in reply to:
↑ description
solarissmoke — 15 months ago
- Keywords reporter-feedback added; dev-feedback removed
comment:2
markoheijnen — 14 months ago
it should have been get_posts(). I will write a test for it so I can see if I can reproduce it again.
Note: See
TracTickets for help on using
tickets.

Replying to markoheijnen:
I don't understand? The only arguments that get_post() accepts are either a post_ID or a post object. You can't use it to fetch a post based on slug etc.