Opened 5 years ago
Last modified 5 years ago
#45171 closed defect (bug)
Adjust wp_insert_post() docs to reflect that the post_category argument will only accept one or more term IDs — at Version 1
Reported by: | DrewAPicture | Owned by: | |
---|---|---|---|
Milestone: | 5.1 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Posts, Post Types | Keywords: | good-first-bug has-patch |
Focuses: | docs | Cc: |
Description (last modified by )
As pointed out by @ck-macleod on the Code Reference, the post_category
argument for wp_insert_post()
actually only accepts term IDs and not an "Array of category names, slugs, or IDs."
This is due to how adding hierarchical taxonomies terms (like categories) works up the stack in wp_insert_post()
-> wp_set_post_categories()
-> wp_set_post_terms()
.
* @type array $post_category Array of category names, slugs, or IDs.
The fix should remove reference to "names" and "slugs" in the $post_category
entry in the hash notation for wp_insert_post()
.
Note: See
TracTickets for help on using
tickets.