Custom Taxonomies Not Displaying in Results

Forums › Forums › Search & Filter Pro › Custom Taxonomies Not Displaying in Results

Viewing 2 posts – 11 through 12 (of 12 total)
  • Anonymous
    #55585

    We got it fixed. Thanks Trevor! Here was the resolution:

    I am using the ACF taxonomy field on the edit screen to provide a better user interface for adding taxonomies (I wanted the site admin to be able to search and pick from a list of existing values instead of typing them, and also restrict them to one choice).

    It turns out there is a miscommunication between S&F and ACF. S&F had a hard time reading the ACF value for those taxonomy terms as they were output in the results table. You’ll notice I was using the ACF field to try to output the taxonomy term into the search results. That’s where the breakdown occurred. Turns out that was unnecessary because I had also linked the ACF taxonomy field to the CPT custom taxonomy.

    The resolution here was to output the taxonomy term using a WordPress function, get_the_terms(), instead of the ACF function. This is what I changed from the code in my first post:

    <div class="inv_make"><?php echo get_the_terms(get_the_ID(), 'vehicle_make')[0]->name; ?></div>
    <div class="inv_model"><?php echo get_the_terms(get_the_ID(), 'vehicle_model')[0]->name; ?></div>

    I will note here that I’m only allowing one term per taxonomy which is why I don’t have this in a loop (which I would need if there was more than one term per taxonomy).

    Trevor
    #55607

    Cool. It worked as I suggested it might 🙂 I will close this thread out now.

Viewing 2 posts – 11 through 12 (of 12 total)

Search & Filter Support
Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.

We also use cookies to store items in your cart as well as allowing your to login on the site.

You can adjust all of your cookie settings by navigating the tabs on the left hand side.

By continuing to use this site, you also agree to our Privacy Policy.