Opened 8 years ago
Last modified 8 years ago
#44630 new defect (bug)
WP_Term_Query does not return all terms when 'number' and 'object_ids' are specified
| Reported by: | ettoredn | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | Awaiting Review |
| Component: | Taxonomy | Version: | |
| Severity: | critical | Keywords: | has-patch has-unit-tests |
| Cc: | Focuses: |
Description
When querying for taxonomy terms assigned to certain objects, WP_Term_Query's query is LIMIT'ed if the 'number' argument is specified. This introduces a problem similar to hierarchical taxonomies where results must not be limited in order to retrieve children. In particular, the issue arises because each term_taxonomy_id, or "(term, taxonomy) couple", has more than one relationship in wp_term_relationships thus more than 1 row could be returned for the same term_taxonomy_id.
It is worth to notice that in order to replicate the problem in the attached test, the 'order' argument must be set to DESC which is the opposite of WP_Term_Query's default.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
PHPUnit test