WordPress.org

Support

Support » How-To and Troubleshooting » Searching custom taxonomy terms

Searching custom taxonomy terms

  • Hi, I’m playing around with custom taxonomies, and would like to start using them live. It’s absolutely essential that the taxonomy terms be searchable via the Search box. How can I implement this? The Search Everything plugin apparently does not have support for custom taxonomy terms.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Yeah, I have the same request. Anyone care to jump in and help?

    So have you actuallly tried querying for taxonomies or terms?

    yoursite.com?s=searchword&taxonomy=TAXNAME&term=TERM

    Yes, and it doesn’t work.

    In fact, the search doesn’t mind the “taxonomy” and “term” fields, based on the syntax that you provided.

    The regular index file should though, so it shouldn’t be hard to add that ability to the search..

    Of course if you were to just query the index like so (providing you havn’t re-coded the query_posts line)..

    yoursite.com/?taxonomy=taxonomy_name&term=term_name , you’d get a list of posts that match (if any), so it essentially searches for them..

    If you’re wanting to search purely for taxonomies and/or terms (and no search word is required), then it wouldn’t make any sense to change the search functionality, just send your request (yoursite.com/?taxonomy=taxonomy&term=term etc..) to the index and let it fetch the matching posts for you..

    For example i’m not sure many people realise but you can also query for a list of posts in a category using the following..

    yoursite.com/?taxonomy=category&term=YOURCATNAME (since categories are also taxonomies)..

    Yeah, I get your point. However, that’s not really what I want to happen.

    What I want is for the search function to browse through not only posts, but also tags, categories, and custom taxonomies (and their respective terms).

    For example, if I search for a particular term (say, “city”), it should display any of the following search results:
    – posts containing the word “city” in its content
    – pages containing the word “city” in its content
    – tags with the term “city” in them (e.g. “new york city” or “big city”)
    – categories with the term “city” in them (e.g. “city landmarks”)
    – taxonomy terms with the term “city” (same as in tags)

    I’d suggest taking a second look at search everything then. If it doesn’t support custom taxonomies, just add the support, there’s no reason you have to run an “as is” version.

    Querying for taxonomies is little different then querying for a post tag, the difference or similarity here is that the taxonomy is “post_tag” as appose to your own given taxonomy… (again, same with categories, the taxonomy being “category”).

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Searching custom taxonomy terms’ is closed to new replies.