WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 5 years ago

#30904 closed defect (bug) (fixed)

Pass post type to count_user_posts() in get_the_author_posts();

Reported by: Caspie Owned by: SergeyBiryukov
Milestone: 4.2 Priority: normal
Severity: normal Version: 4.1
Component: Posts, Post Types Keywords: has-patch
Focuses: template Cc:

Description

Prevents possible wrong posts count, return when no post type is passed - the default "post" is used. Related to the enhancement in #21364

Attachments (2)

30904.diff (398 bytes) - added by Caspie 5 years ago.
pass post type
30904-tests.patch (743 bytes) - added by tyxla 5 years ago.
Adding an assertion in the unit test Tests_User_Author::test_get_the_author_posts() that checks for the new $post->post_type parameter usage in the count_user_posts() call within get_the_author_posts().

Download all attachments as: .zip

Change History (7)

@Caspie
5 years ago

pass post type

#1 @Caspie
5 years ago

  • Keywords has-patch needs-testing added

#2 @Caspie
5 years ago

For cases when get_the_author_posts() is called and the current post is of a custom post type.

#3 @SergeyBiryukov
5 years ago

  • Keywords needs-unit-tests added; needs-testing removed
  • Milestone changed from Awaiting Review to 4.2

@tyxla
5 years ago

Adding an assertion in the unit test Tests_User_Author::test_get_the_author_posts() that checks for the new $post->post_type parameter usage in the count_user_posts() call within get_the_author_posts().

#4 @tyxla
5 years ago

  • Keywords needs-unit-tests removed

#5 @SergeyBiryukov
5 years ago

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

In 31098:

Pass post type to count_user_posts() in get_the_author_posts().

props Caspie, tyxla.
fixes #30904.

Note: See TracTickets for help on using tickets.