#20451 closed enhancement (fixed)
wp_insert_post() should accept a meta_input argument
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Milestone: | 4.4 | Priority: | low |
| Severity: | normal | Version: | |
| Component: | Posts, Post Types | Keywords: | has-patch commit |
| Focuses: | Cc: |
Description
wp_insert_post() accepts a tax_input argument to set the post's terms, but there's no similar argument to set the post's meta fields. add_post_meta() must be called for each meta field after wp_insert_post() is called.
I'll do up a patch at some point.
Attachments (2)
Change History (9)
#1
@
14 years ago
Provided patch proves that it can be done really easy. This patch does not check for capabilities and there is lots of room for improvement. Just showing how easy it can be.
Now on to if it should be done and what we need to consider before doing so.
#2
@
12 years ago
Surprised this isn't implemented, especially with the meta field initiative going on.
#3
@
11 years ago
- Keywords has-patch added
- Milestone changed from Awaiting Review to 4.4
20451.2.diff is an updated patch that also updates the docblock for wp_insert_post and includes a unit test for the newly added meta_input parameter.
Note: See
TracTickets for help on using
tickets.
Basic fix that loops through provided meta fields and values