WordPress.org

Make WordPress Core

Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#25230 closed defect (bug) (fixed)

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

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

Description

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

Attachments (2)

25230.diff (474 bytes) - added by SergeyBiryukov 6 years ago.
25230.1.diff (418 bytes) - added by chrisbliss18 6 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
6 years ago

  • Owner set to wonderboymusic
  • Resolution set to fixed
  • Status changed from new to closed

In 25245:

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

Fixes #25230.

@SergeyBiryukov
6 years ago

#2 @SergeyBiryukov
6 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

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

#3 @wonderboymusic
6 years ago

In 25270:

Simplify the check for false-y child_of arg.

Props SergeyBiryukov.
See #25230, [25245].

#4 @wonderboymusic
6 years ago

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

@chrisbliss18
6 years ago

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

#5 @chrisbliss18
6 years ago

  • Cc gaarai@… added
  • Resolution fixed deleted
  • Status changed from closed to reopened

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
6 years ago

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

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
6 years ago

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

Note: See TracTickets for help on using tickets.