Make WordPress Core

Opened 6 years ago

Closed 6 years ago

Last modified 5 years ago

#13435 closed defect (bug) (invalid)

Can't Query a Term from a Custom Taxonomy

Reported by: developdaly Owned by: ryan
Milestone: Priority: high
Severity: normal Version:
Component: Query Keywords:
Focuses: Cc:


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 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)

#1 @developdaly
6 years ago

  • Component changed from General to Query
  • Owner set to ryan

#2 @wpmuguru
6 years ago



When using custom taxonomies you are using terms not tags. It would be confusing if tag_id were able to query any term taxonomy.

#3 @wpmuguru
6 years ago

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

marking as invalid

#4 @developdaly
6 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.

#5 @hakre
6 years ago

Is there a term_ID maybe?

#6 @hakre
6 years ago

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.

#7 @nacin
5 years ago

  • Milestone 3.0 deleted
Note: See TracTickets for help on using tickets.