I got a map and after i query the location it do a ajax refresh and show the nearest center within the vicinity. I got set the ordering in my view settings hidden link
i got a search address input such that when i search the result return will be a the post within 5km. I successfully got the post but i can't sort them by nearest distance.
Can you please share details what address I should use to search and what is your expected order to display the result and send me problem URL and admin access details and let me review what could be the possible workaround or solution I may offer you, if it really possible.
*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.
I have set the next reply to private which means only you and I have access to it.
Ok - if you not able to share production site access details then you can share with me staging site access details.
Also, as shared in what sort order you want to display the result? Also I need to review your current view settings as well.
If you can share staging site access details that would be great or if you want I can give you sandbox site where you can setup same view with few entries and then I will take a look further.
Please let me know with what option you would like to proceed further.
My current primary ordering in acf field count and secondary sorting is post title. after user enter a address it will filter out the post by nearest 5km posts. the result will be sort as nearest centre at the top.
I tried to log the id to see it exist and below is my code:
error_log('lk-test custom_combined_filter_query filtered_ids: ' . $_GET['filtered_id_by_location']);
if (!empty($_GET['filtered_id_by_location'])) {
$filtered_ids = array_map('intval', explode(',', $_GET['filtered_id_by_location']));
$query_args['post__in'] = $filtered_ids;
//error_log('Filtered IDs applied in custom_combined_filter_query: ' . var_dump($filtered_ids));
$query_args['orderby'] = implode(", ", $filtered_ids);
}
Beside the above can i also check the pagination, after i search, it successfully return the unsorted post, but when i click on page 2 the filtered post got reset.
you may try this postal: 522663 for the search and clicking on page 2 from the pagination
I'm not sure but you may have use the search section and result section displayed in different section of the page. If this is true - What if you try to filter the view without using ajax and same for pagination.