Support

Account

Home Forums Backend Issues (wp-admin) Sorting search results by ACF date fields Reply To: Sorting search results by ACF date fields

  • You have 2 problems

    The first is an error in your code, this

    
    $query->is_search
    

    should be this

    
    $query->is_search()
    

    The second thing is that ordering by several fields is not going to work the way I suspect you think it will or want it do. The second field will be order within the order or the first. An example:

    Let’s say that you have two fields

    1. State
    2. County

    and you order the posts first by state and then by county. It will order all of the posts alphabetically by state and then by county within each state.

    • State
      • county
      • county
      • county
      • county
      • county
      • county
    • State
      • county
      • county
      • county
      • county
      • county
      • county