Make WordPress Core

Opened 12 years ago

Closed 12 years ago

#31036 closed defect (bug) (fixed)

WP_Date_Query docblock doesn't properly describe array inputs

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

Description

See https://core.trac.wordpress.org/ticket/31001#comment:7 and https://core.trac.wordpress.org/attachment/ticket/31001/31001.2.patch

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 12 years ago.

Download all attachments as: .zip

Change History (5)

@boonebgorges
12 years ago

#1 @boonebgorges
12 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
12 years ago

  • Owner set to DrewAPicture
  • Status newreviewing

#3 @DrewAPicture
12 years ago

  • Keywords has-patch added

#4 @DrewAPicture
12 years ago

  • Resolutionfixed
  • Status reviewingclosed

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.