Make WordPress Core

Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#58685 closed defect (bug) (fixed)

Fix return description for wp_count_posts()

Reported by: crstauf Owned by: SergeyBiryukov
Priority: normal Milestone: 6.3
Component: Posts, Post Types Version:
Severity: normal Keywords: has-patch
Cc: Focuses: docs

Description

If post type passed to wp_count_posts() does not exist, function returns an empty stdClass: adjust the @return description to indicate this.

Change History (6)

This ticket was mentioned in ​PR #4769 on ​WordPress/wordpress-develop by ​@crstauf.


3 years ago
#1

  • Keywords has-patch added

Update @return description for wp_count_posts() to include returned value if post type is invalid.

Trac ticket: https://core.trac.wordpress.org/ticket/58685

#2 @crstauf
3 years ago

Reported by @ov3rfly in User Contributed Notes.

Last edited 3 years ago by crstauf (previous) (diff)

#3 @crstauf
3 years ago

  • Focuses docs added

#4 @SergeyBiryukov
3 years ago

  • Component General → Posts, Post Types
  • Milestone Awaiting Review → 6.3

#5 @SergeyBiryukov
3 years ago

  • Owner set to SergeyBiryukov
  • Resolution → fixed
  • Status new → closed

In 56120:

Docs: Correct @return description for wp_count_posts().

Add a note that wp_count_posts() returns an empty object if the post type passed to the function does not exist.

Follow-up to [6730], [6808], [8081], [24826], [29093], [51885].

Props crstauf, Ov3rfly.
Fixes #58685.

​@SergeyBiryukov commented on ​PR #4769:


3 years ago
#6

Thanks for the PR! Merged in r56120.

Note: See TracTickets for help on using tickets.