Opened 13 months ago
Last modified 13 months ago
#20451 new enhancement
wp_insert_post() should accept a meta_input argument
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Priority: | low | Milestone: | Awaiting Review |
| Component: | Post Types | Version: | |
| Severity: | normal | Keywords: | |
| 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 (1)
Change History (2)
CoenJacobs — 13 months ago
comment:1
CoenJacobs — 13 months 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.
Note: See
TracTickets for help on using
tickets.

Basic fix that loops through provided meta fields and values