Make WordPress Core

Opened 13 years ago

Closed 13 years ago

Last modified 13 years ago

#25230 closed defect (bug) (fixed)

In get_pages, don't require hierarchical => false for parent arg

Reported by: wonderboymusic Owned by: wonderboymusic
Priority: normal Milestone: 3.7
Component: Query Version: 1.5
Severity: normal Keywords: has-patch
Cc: Focuses:

Description

parent requires hierarchical => false, which defaults to true. Should set to false automatically.

Attachments (2)

25230.diff (474 bytes ) - added by SergeyBiryukov 13 years ago.
25230.1.diff (418 bytes ) - added by chrisbliss18 13 years ago.
Fix for bug that disables hierarchical when parent is -1 (which it is by default)

Download all attachments as: .zip

Change History (9)

#1 @wonderboymusic
13 years ago

  • Owner set to wonderboymusic
  • Resolutionfixed
  • Status newclosed

In 25245:

Set hierarchical to false when parent is passed to get_pages() and child_of is not.

Fixes #25230.

#2 @SergeyBiryukov
13 years ago

  • Resolution fixed
  • Status closedreopened

Can this be simplified along the lines of the first change in [23599]? See 25230.diff.

#3 @wonderboymusic
13 years ago

In 25270:

Simplify the check for false-y child_of arg.

Props SergeyBiryukov.
See #25230, [25245].

#4 @wonderboymusic
13 years ago

  • Resolutionfixed
  • Status reopenedclosed

@chrisbliss18
13 years ago

Fix for bug that disables hierarchical when parent is -1 (which it is by default)

#5 @chrisbliss18
13 years ago

  • Cc gaarai@… added
  • Resolution fixed
  • Status closedreopened

Added a new patch for this issue as the original one introduced a bug that causes the hierarchical argument, which is enabled by default, to be disabled when -1 is supplied for the parent argument, it is -1 by default.

The problem seems to be that in simplifying the conditional, the "> 0" portion of the conditional was removed. Since -1 is truthy, the conditional incorrectly applied when -1 was supplied for parent.

My supplied patch, 25230.1.diff, fixes this issue.

#6 @SergeyBiryukov
13 years ago

  • Resolutionfixed
  • Status reopenedclosed

25230.1.diff looks good, please open a new ticket and upload the patch there. This one was closed on a completed milestone.

#7 @chrisbliss18
13 years ago

Will do. I wasn't sure about the process on such issues.

Note: See TracTickets for help on using tickets.