Sort by – Can it use Taxonomies?

Forums › Forums › Search & Filter Pro › Sort by – Can it use Taxonomies?

Viewing 2 posts – 1 through 2 (of 2 total)
  • Anonymous
    #272249

    We are trying to add the “Sort by filter” to our search results page so the user can choose how they’d like to sort. Currently, the options are not there to sort by our taxonomies. Is there a way to do this vs. using the default WP fields which are irrelevant to our users.

    Trevor
    #272299

    If data terms are stored as a taxonomy, they cannot be sorted, as taxonomy data are stored as serialized data (multiple terms, like an array) per post (which term in the array would you sort by?). Even if only one term per post is used, WordPress still stores them like this.

    You would need to make a custom field (using a plugin like Advanced Custom Fields or a similar plugin) and allocate a value you can sort by, but, be warned, if a post does not have a value in this field, then it will not appear at all in the results if you use the field to order by. Custom fields can store data as single values or serialized data, so only those fields set to store the data as single values can be sorted.

Viewing 2 posts – 1 through 2 (of 2 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.