Make WordPress Core

Opened 10 years ago

Closed 7 years ago

Last modified 7 years ago

#38435 closed defect (bug) (duplicate)

Wrong documentation for wp_insert_post

Reported by: nabil_kadimi Owned by:
Priority: normal Milestone:
Component: Posts, Post Types Version: 4.2
Severity: normal Keywords: has-patch good-first-bug
Cc: Focuses: docs

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)

wp_insert_post_docs.diff​ (6.9 KB ) - added by nabil_kadimi 10 years ago.
wp_insert_post_docs.2.diff​ (6.9 KB ) - added by nabil_kadimi 10 years ago.
Corrected patch.
wp_insert_post_docs.3.diff​ (961 bytes ) - added by nabil_kadimi 10 years ago.
Corrected patch.

Download all attachments as: .zip

Change History (13)

@nabil_kadimi
10 years ago

Corrected patch.

#1 @nabil_kadimi
10 years ago

  • Type enhancement → defect (bug)

#2 @nabil_kadimi
10 years ago

Just noticed only arrays are working, updating patch again.

@nabil_kadimi
10 years ago

Corrected patch.

#3 @kovshenin
10 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.


10 years ago

#5 @helen
10 years ago

  • Version trunk → 4.2

#6 @desrosj
8 years ago

  • Keywords needs-refresh good-first-bug added
  • Milestone Awaiting Review → Future Release

@nabil_kadimi are you able to refresh the patch and make the changes @kovshenin suggested?

#7 @angelagibson
8 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

This ticket was mentioned in ​Slack in #core by hareesh-pillai. ​View the logs.


7 years ago

#9 @Hareesh Pillai
7 years ago

  • Resolution → duplicate
  • Status new → closed

Duplicate of #45171.

Closing this ticket as the proposed change is already made.

#10 @SergeyBiryukov
7 years ago

  • Component General → Posts, Post Types
  • Keywords needs-refresh removed
  • Milestone Future Release
Note: See TracTickets for help on using tickets.