Support

Account

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

  • Hello John

    Many thanks for the advice. I have corrected the spelling mistake in is_search.

    The explanation regarding the sorting explains exactly what I see in the output of the search results after sorting by date.

    What I still don’t understand is that the sorting works when querying the two cpts on an overview page (first code section) but not in the search.

    Can I rewrite the search query so that sorting by date works or would ACF fields have to be named the same in order to enable sorting with $query->set('orderby', 'meta_value'); $query->set('meta_key', 'date_field_name');?