Support Forums

The forums are closed and will be removed when we launch our new site.

Looking for support? You can access the support system via your account.

Forums Forums Search & Filter Pro ACF sorty by relationship field

Viewing 2 posts - 1 through 2 (of 2 total)
  • Vanessa
    #227324

    Hi, I want to sort my posts by a relationship field in alphabetical order.
    But Instead of using the title it’s using the Custom Post Type IDs.
    Is there a way to tell the system it’s supposed to take the term and not the id?

    Trevor Moderator
    #227327

    Not easily, sorry, no (if at all). The problem is that we index the cache by that ID, because, in the posts being searched, that is all ACF stores in the custom field. For the form, we have to use some code to grab the label.

    What you would have to do is set no sort in the form settings, but instead use this filter:

    https://searchandfilter.com/documentation/action-filter-reference/#edit-query-arguments

    In that, you would need to somehow (I don’t know how) need to create an array with the post IDs of the related post type and their labels, and some how set up an orderby that would do what you want. As I said, I cannot think how that could be done.

Viewing 2 posts - 1 through 2 (of 2 total)

The forum ‘Search & Filter Pro’ is closed to new topics and replies.