Proximity Queries

Event and venue proximity queries require Event Organiser Pro to be installed alongside Event Organiser. If you haven’t done so already, you can purchase Pro here:

This page demonstrates how you can query venues by proximity. If you wish to retrieve events based on proximity, read this page, and then read Getting Events via Venue Queries.

The ‘proximity query’ extends the meta_query (discussed here) component and each ‘proximity’ array can contain the following:

  • center (array) – Array index by ‘lat’ and’lng’
  • distance (int) – Optional. A distance from the center point.
  • unit (string) – ‘miles’ or ‘km’ (kilometres). Default: ‘miles’.
  • compare – how the query the venues by distance (e.g. venues which are less than X miles away, venues which are greater than X miles away etc). Possible values are ‘=’, ‘>’, ‘>=’, ‘<‘, ‘<=’. Default value is ‘<=’.

When the venue meta query includes a proximity query you can set ‘orderby’ to ‘distance’. If you wish to query all venues, but order them by a distance from some point, then you still need to include a proximity query – but you do not need to set a distance.


//Get venues within 10 miles of Windsor Castle, order by distance
$venue_query = array(
    'proximity' => array(
        'center'   => eo_remote_geocode( "Windsor [castle]" ),
        'distance' => 10,
        'unit'     => 'miles',
        'compare'  => '<='

$venues = eo_get_venues( array( 
    'orderby'    => 'distance', 
    'order'      => 'ASC',
    'meta_query' => $venue_query 

Getting a location’s latititude/longtitude co-ordinates:

See the the documentation for the function eo_remote_geocode()