Opened 3 years ago
Last modified 3 years ago
#11823 new enhancement
Improve SQL query used by get_terms()
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Priority: | normal | Milestone: | Future Release |
| Component: | Taxonomy | Version: | 3.0 |
| Severity: | normal | Keywords: | has-patch needs-testing |
| Cc: | kevinB |
Description
#11076 / [12658] changes get_terms() so it uses SQL query with multiple conditions in WHERE clause - one for each included / excluded term. It will be better to change generated SQL from:
AND (t.term_id = 1 OR t.term_id = 2 OR ...) AND (t.term_id <> 1 AND t.term_id <> 2 AND ...)
to:
AND t.term_id IN (1, 2, ...) AND t.term_id NOT IN (1, 2, ...)
Attachments (2)
Change History (6)
- Milestone changed from 3.0 to Future Release
instead of those ugly loops, something similar to this might be possible?
$interms = array_map('intval', $interms);
$inclusions = ' AND t.term_id IN ( ' . implode(',', $interms) . ' )';
(note, Untested, and havnt looked at the code closer than the patch)
Note: See
TracTickets for help on using
tickets.

OK, looks that I have to provide a patch for this :)