#38435 closed defect (bug) (duplicate)
Wrong documentation for wp_insert_post
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Priority: | normal | |
| Severity: | normal | Version: | 4.2 |
| Component: | Posts, Post Types | Keywords: | has-patch good-first-bug |
| Focuses: | docs | Cc: |
Description
The post_category parameter accepts IDs or array of IDs, the doc says: "Array of category names, slugs, or IDs".
Here's a patch.
Attachments (3)
Change History (13)
#3
@
9 years ago
- Keywords has-patch added
Might also be worth fixing the docs in the other related functions:
- wp_set_post_categories
- wp_set_post_terms
For reference, from wp_set_post_terms:
/*
* Hierarchical taxonomies must always pass IDs rather than names so that
* children with the same names but different parents aren't confused.
*/
if ( is_taxonomy_hierarchical( $taxonomy ) ) {
$tags = array_unique( array_map( 'intval', $tags ) );
}
This ticket was mentioned in Slack in #core by helen. View the logs.
9 years ago
#6
@
7 years ago
- Keywords needs-refresh good-first-bug added
- Milestone changed from Awaiting Review to Future Release
@nabil_kadimi are you able to refresh the patch and make the changes @kovshenin suggested?
#7
@
7 years ago
I'm new to contributing but I took a look at this. If I understand correctly, after reviewing the code it looks like the updates referenced above have already been made. wp_set_post_categories() and wp_insert_post() were both changed in ticket:45171 changeset:44660. wp_set_post_terms() was updated in ticket:42505 changeset:42664
Corrected patch.