Make WordPress Core

Opened 9 years ago

Closed 9 years ago

#31036 closed defect (bug) (fixed)

WP_Date_Query docblock doesn't properly describe array inputs

Reported by: boonebgorges's profile boonebgorges Owned by: drewapicture's profile DrewAPicture
Milestone: 4.2 Priority: normal
Severity: normal Version:
Component: Query Keywords: has-patch
Focuses: docs Cc:


See and

Many of the params in WP_Date_Query accept arrays rather than ints - and, indeed, BETWEEN and NOT BETWEEN *require* arrays - but the documentation doesn't make this clear.

Attachments (1)

31036.diff (5.6 KB) - added by boonebgorges 9 years ago.

Download all attachments as: .zip

Change History (5)

9 years ago

#1 @boonebgorges
9 years ago

DrewAPicture - If you have a moment, could you give your feedback on 31036.diff? The rub is that a bunch of parameters that normally require int values accept or even require array values when used in conjunction with certain values of compare. This is a hard (and redundant) thing to spell out in the array hash, so I've added a paragraph to the long description. What do you think?

#2 @DrewAPicture
9 years ago

  • Owner set to DrewAPicture
  • Status changed from new to reviewing

#3 @DrewAPicture
9 years ago

  • Keywords has-patch added

#4 @DrewAPicture
9 years ago

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

In 31336:

Clarify inline documentation for WP_Date_Query to better explain the relationship between an individual clause's 'compare' argument and various integer-based date arguments.

If the 'compare' argument equals 'IN' or 'NOT IN', arrays of any number of specific, valid values are accepted and simply considered based on the value of 'operator' (OR or AND). If the 'compare' argument is a range such as 'BETWEEN' or 'NOT BETWEEN', arrays of only two valid values are accepted.

Props boonebgorges.
Fixes #31036.

Note: See TracTickets for help on using tickets.