geo-query icon indicating copy to clipboard operation
geo-query copied to clipboard

404 Error in get_pre_posts Callback

Open brainsyke opened this issue 5 years ago • 2 comments

I am getting 404 error. How do i get this to work correctly? Am I doing something incorrect? See images attached for details. please Help!!

function filter_queryby_currentcity( $query ) { if ( !is_admin() ) { getGeoipDetails(); //print_r("filter:".trim(getGeoipDetails()["city"])); // print_r("IP Based geo details".microtime(true).":".$GLOBALS['location_details']['geolat']);

$query->set( 'geo_query', [
  'lat'                =>  $GLOBALS['location_details']['geolat'],                                // Latitude point
    'lng'                =>  $GLOBALS['location_details']['geolong'],                               // Longitude point
   'lat_meta_key'       =>  '_tmbu_lat',                         // Meta-key for the latitude data
   'lng_meta_key'       =>  '_tmbu_lng',                         // Meta-key for the longitude data 
   'radius'             =>  50,                               // Find locations within a given radius (km)
   'order'              =>  'DESC',                            // Order by distance
   'distance_unit'      =>  111.045,                           // Default distance unit (km per degree). Use 69.0 for statute miles per degree.
   'context'            => '\\Birgir\\Geo\\GeoQueryHaversine' // Default implementation, you can use your own here instead.

post_meta_tabe print_rquery ]);

brainsyke avatar Mar 03 '19 00:03 brainsyke

Thanks for the ticket @brainsyke

I will try to look at it when I have some more time in the next few days.

birgire avatar Mar 05 '19 09:03 birgire

I am trying to modify the default search query using pre_get_posts . However , it is not working ! Please help

HimanshuBorah avatar Jun 18 '20 11:06 HimanshuBorah