#13435 closed defect (bug) (invalid)
Can't Query a Term from a Custom Taxonomy
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Priority: | high | Milestone: | |
| Component: | Query | Version: | |
| Severity: | normal | Keywords: | |
| Cc: |
Description
Using the following query I should be able to return a subset of posts with a post type of "listing" in a custom taxonomy of "listing-neighborhood" and term/tag ID of "12".
/?taxonomy=listing-neighborhood&post_type=listing&tag_ID=12
/?taxonomy=listing-neighborhood&post_type=listing works, but I'm not able to specify a term.
I was told this may be due to post_tag still being hardcoded into query.php around line 1940 instead of a term variable.
Change History (7)
comment:1
developdaly — 3 years ago
- Component changed from General to Query
- Owner set to ryan
- Resolution set to invalid
- Status changed from new to closed
marking as invalid
comment:4
developdaly — 3 years ago
So is there not a method of retrieving terms by their ID?
The backend makes use of /wp-admin/edit-tags.php?action=edit&taxonomy=listing-neighborhood&post_type=listing&tag_ID=12.
I just looked a bit in WP_Query and it looks like there are no input point to use it querying for a nunerical term_id.
get_category() might be helpfull in that case to convert the numerical id into a category object first and obtain the name.

Try
/?taxonomy=listing-neighborhood&post_type=listing&term=term-slug
When using custom taxonomies you are using terms not tags. It would be confusing if tag_id were able to query any term taxonomy.