WordPress.org

Make WordPress Core

Opened 3 years ago

Last modified 7 months ago

#39049 new defect (bug)

get_pages() docs say function returns list, actually returns array

Reported by: ovenall Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Posts, Post Types Keywords: has-patch close
Focuses: docs Cc:
PR Number:

Description

This function returns an array of posts, not a list.
Please correct both first paragraph and “Returns” section.

Attachments (1)

39049.patch (731 bytes) - added by ben.meredith@… 3 years ago.
corrects the wording.

Download all attachments as: .zip

Change History (4)

@ben.meredith@…
3 years ago

corrects the wording.

#1 @ben.meredith@…
3 years ago

  • Keywords has-patch added

#2 @swissspidy
3 years ago

  • Keywords close added
  • Version trunk deleted

Hey there,

Thanks for opening this ticket and welcome to WordPress Trac!

The terms array and list are often used interchangeably in documentation throughout WordPress core. In fact, searching for "a list of" in core returns almost 150 results. The return type clearly says array and there's no List interface like in Java or many other programming languages that this could be mixed up with. Thus, I do not think that there's much confusion. If it turns out to be very confusing for developers, this should be applied to all relevant sections and not just get_pages()

#3 @ben.meredith@…
3 years ago

When I hear list, I guess I just think about a ul or ol in html. As a relative beginner, I've been tripped up by it in the docs. If I went through and changed all of those and submitted a patch, would that be accepted? Since the PHPdocs are also pushed to the code reference, I think it could be a big help for devs like me. But I obviously defer to your knowledge there.

Note: See TracTickets for help on using tickets.