Make WordPress Core

Opened 8 years ago

Closed 4 years ago

#39049 closed defect (bug) (fixed)

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

Reported by: ovenall's profile ovenall Owned by: sergeybiryukov's profile SergeyBiryukov
Milestone: 5.6 Priority: normal
Severity: normal Version:
Component: Posts, Post Types Keywords: needs-refresh
Focuses: docs Cc:

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@… 8 years ago.
corrects the wording.

Download all attachments as: .zip

Change History (8)

@ben.meredith@…
8 years ago

corrects the wording.

#1 @ben.meredith@…
8 years ago

  • Keywords has-patch added

#2 @swissspidy
8 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@…
8 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.

#4 @johnbillion
4 years ago

  • Keywords close removed

#5 @Hareesh Pillai
4 years ago

  • Component changed from Posts, Post Types to General
  • Keywords needs-refresh added; has-patch removed

#6 @SergeyBiryukov
4 years ago

  • Component changed from General to Posts, Post Types
  • Milestone changed from Awaiting Review to 5.6
  • Owner set to SergeyBiryukov
  • Status changed from new to reviewing

#7 @SergeyBiryukov
4 years ago

  • Resolution set to fixed
  • Status changed from reviewing to closed

In 49595:

Docs: Clarify that get_pages() returns an array of pages, not an HTML list.

Props ben.meredith@…, ovenall, johannadevos.
Fixes #39049. See #51768.

Note: See TracTickets for help on using tickets.