Hello,
First I’d like to thank you for this amazing plugin, it saved me a lot of time !
Unfortunately, I encounter a problem when I query the French version of a city located in the United States. For example:
$query = new WP_Query([
"post_type" => "users",
"geo_query" => [
"location" => "Las Vegas, Nevada, états-Unis",
"radius" => 10,
"units" => "km"
]
]);
This query returns the complete list of users, even though none of them are located near Las Vegas.
I tried with several other cities like Seattle or New York, same behavior.
The request is working fine with other country or when I send the english version of the city “Las Vegas, NV, USA”.
Do you have any idea how I can solve this problem? Or if it’s a problem with your plugin?
]]>First of all, thank you very much for your library.
I’m new to WordPress development and I’m not sure how to use it in another context than a pure WP_Query.
Is it possible to make “geo_query” works in this context?
/**
* Override School Archive Query
* https://codex.www.ads-software.com/Plugin_API/Action_Reference/pre_get_posts
*/
function school_archive( $query ) {
if ( $query->is_archive('school') && $query->is_main_query() && !is_admin() ) {
$zipcode = get_query_var( 'zipcode', FALSE );
if ( !is_numeric($zipcode)) { $zipcode = null; }
//$query-> set('p' , null);
if (!is_null($zipcode)) {
$query->set( 'geo_query', ["location" => $zipcode] );
$query->set( 'orderby', 'geo');
}
$query->set( 'posts_per_page', '20' );
}
}
add_action( 'pre_get_posts', 'school_archive' );
]]>
I have an instance where I need to order by a custom field value before ordering by distance(DESC).
E.g. this is how posts should be ordered
$args[‘orderby’] = [
‘meta_value’ => ‘DESC’,
// then
‘geo’ => ‘DESC’
]
However, they are always ordered by distance regardless, seemingly because of the ‘posts_orderby’ filter which is overwriting the query ‘orderby’.
Also, the ‘geo’ param referenced in the docs does not seem to work?
Appreciate anyone’s help on this.
]]>Hello,
how to use this plugin? Is there any example?
I like to use the standard WordPress search, this should be the wp_query I think.
And I have custom fields in my posts … lat and lng.
What do I have to do now, that the results page shows my results PLUS they match the geo search.
Hope to get help,
Thanks,
Denis
WordPress database prefixes were hardcoded into search functions. Anyone using a custom database prefix would experience table not found errors. I submitted a pull request on Github with the changes I made to get the plugin working for me and others using a custom database prefix.
]]>Hello, was just wondering if this could be adapted to search the users as well. How would that work? Future feature?
Thanks
]]>