Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

404 Error in get_pre_posts Callback #16

Open
brainsyke opened this issue Mar 3, 2019 · 2 comments
Open

404 Error in get_pre_posts Callback #16

brainsyke opened this issue Mar 3, 2019 · 2 comments

Comments

@brainsyke
Copy link

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
]);

@birgire
Copy link
Owner

birgire commented Mar 5, 2019

Thanks for the ticket @brainsyke

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

@HimanshuBorah
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants