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)