WordPress.org

Make WordPress Core

Opened 2 years ago

Closed 2 years ago

#37002 closed enhancement (fixed)

Documentation: update wp_get_post_categories @return description

Reported by: jeherve Owned by: DrewAPicture
Milestone: 4.6 Priority: normal
Severity: normal Version: 4.0
Component: Posts, Post Types Keywords: has-patch commit
Focuses: docs Cc:

Description

The function returns an array of Category IDs. Knowing that is helpful when wanting to do something with the function.

Right now, we only mention that the function returns "an array of categories".

Attachments (3)

37002.diff (608 bytes) - added by jeherve 2 years ago.
Documentation: update wp_get_post_categories inline doc.
37002.2.diff (960 bytes) - added by DrewAPicture 2 years ago.
37002.3.diff (961 bytes) - added by DrewAPicture 2 years ago.

Download all attachments as: .zip

Change History (10)

@jeherve
2 years ago

Documentation: update wp_get_post_categories inline doc.

#1 @jeherve
2 years ago

  • Keywords has-patch added

#2 @jeherve
2 years ago

  • Component changed from General to Posts, Post Types

#3 @rachelbaker
2 years ago

@jeherve I agree that the return description should signal the default behavior, but it isn't absolute. If you use array( 'fields' => 'all' ) as the $args parameter you no longer are returned just an array of IDs.

#4 follow-up: @jeherve
2 years ago

That makes sense, I didn't think of that. Should that be mentioned in the @return value somehow? Something along the lines of

@return array List of categories. Default to category IDs, can return additional data when specifying category arguments.

#5 in reply to: ↑ 4 @rachelbaker
2 years ago

Replying to jeherve:

That makes sense, I didn't think of that. Should that be mentioned in the @return value somehow? Something along the lines of

@return array List of categories. Default to category IDs, can return additional data when specifying category arguments.

@DrewAPicture care to wordsmith something here?

@DrewAPicture
2 years ago

#6 @DrewAPicture
2 years ago

  • Keywords commit added
  • Milestone changed from Awaiting Review to 4.6

@rachelbaker See 37002.3.diff

Last edited 2 years ago by DrewAPicture (previous) (diff)

@DrewAPicture
2 years ago

#7 @DrewAPicture
2 years ago

  • Owner set to DrewAPicture
  • Resolution set to fixed
  • Status changed from new to closed

In 37686:

Docs: Improve the return description for wp_get_post_categories() to include more information about possible return values.

Props jeherve for the initial patch.
Fixes #37002.

Note: See TracTickets for help on using tickets.