WordPress.org

Ready to get started?Download WordPress

Forums

Searching custom taxonomy terms (7 posts)

  1. leer
    Member
    Posted 5 years ago #

    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.

  2. davaobase
    Member
    Posted 4 years ago #

    Yeah, I have the same request. Anyone care to jump in and help?

  3. Mark / t31os
    Moderator
    Posted 4 years ago #

    So have you actuallly tried querying for taxonomies or terms?

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

  4. davaobase
    Member
    Posted 4 years ago #

    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.

  5. Mark / t31os
    Moderator
    Posted 4 years ago #

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

  6. davaobase
    Member
    Posted 4 years ago #

    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)

  7. Mark / t31os
    Moderator
    Posted 4 years ago #

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

Topic Closed

This topic has been closed to new replies.

About this Topic