#45171 closed defect (bug) (fixed)
Adjust wp_insert_post() docs to reflect that the post_category argument will only accept one or more term IDs
Reported by: | DrewAPicture | Owned by: | pento |
---|---|---|---|
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()
.
Attachments (1)
Change History (9)
#3
@
6 years ago
- Keywords has-patch added
Fix doc comment of wp_insert_post
.
Besides that, doc comment of wp_set_post_categories
is also vague(List of categories
), so I fixed it's more concrete List of category IDs
.
#4
@
6 years ago
- Milestone changed from Future Release to 5.1
- Owner set to Takahashi_Fumiki
- Status changed from new to assigned
Assigning to mark the good-first-bug
as "claimed".
Hi @Takahashi_Fumiki, thanks for the patch! Everything looks good here.
Trunk development is still closed pending the 5.0 release, but we should be able to get this in with 5.1.
Fix doc comment of wp_insert_post and wp_set_post_categories.