WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 5 years ago

#9960 closed defect (bug) (fixed)

get_terms() fails to work with parent=0

Reported by: Denis-de-Bernardy Owned by: filosofo
Milestone: 2.8 Priority: normal
Severity: major Version: 2.8
Component: Taxonomy Keywords: has-patch tested dev-feedback
Focuses: Cc:

Description

It then returns all terms.

Attachments (1)

9960.diff (1.1 KB) - added by Denis-de-Bernardy 5 years ago.

Download all attachments as: .zip

Change History (5)

comment:1 follow-up: filosofo5 years ago

I can't reproduce this on trunk. When I query get_terms('category','parent=0'); it returns all categories at the top of the hierarchy. In other words, those without parents, which is the expected behavior.

Denis-de-Bernardy5 years ago

comment:2 Denis-de-Bernardy5 years ago

  • Keywords has-patch tested dev-feedback added

Attached patch makes it work as expected, and I found no trace of the argument getting used in WP. It might have some minor side effects on plugins.

Please give early feedback, so I whether I should seek a workaround for my plugin.

comment:3 in reply to: ↑ 1 Denis-de-Bernardy5 years ago

Replying to filosofo:

I can't reproduce this on trunk. When I query get_terms('category','parent=0'); it returns all categories at the top of the hierarchy. In other words, those without parents, which is the expected behavior.

It what I thought too, until I added a post in the empty subcat I created to verify.

comment:4 ryan5 years ago

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

(In [11476]) Fix parent=0 queries. Props Denis-de-Bernardy 107 minutes ago. . fixes #9960

Note: See TracTickets for help on using tickets.