In the context of search, the query parameters are fields in the search form. To add lat and lng to the search you would include fields for lat and lng in the search form. If they have pre-defined values that the user cannot change you can make these hidden type inputs.
Hello Jacob,
thanks for your answer. To test my query I will use the hidden fields.
But in futur I like the LAT & LNG to be dynamic, cause of what the visitor is came from.
So I need some HOOK or anything else, to modify the query URL with the visitors GEO data (lat & lng).
Cheers,
Denis
You don’t need a hook to modify the URL, just use whatever function determines the user’s location to populate the hidden fields.
Hello Jacob,
so I need to do it with JAVA Script or someting? Cause the user should finally only enter his Postcode and/or his address. Then before sending the search form the postcode must be transformed into lat/lng 🙂
This seems to be a bit tricky.
therefor I think it seems to be esier to hook into the query and then do int via the functions.php.
I must say that is a real cross to do a radius/geo seaarch with wordpress (without using a not fitting theme :-))
Cheers,
Denis
FWIW, query vars can be altered in the “request” filter, but because ALL requests go through this filter, it may not be the best approach.
If lat/lng is unknown to the form, but can be determined server side from post code or address, it’s better to do this in the server side form handling code. The form handler can do it all, including instantiating a WP_Query object to do the search and generating the output from the results. This will be more efficient than feeding the lat/lng determination back into another WP request.