Code snippets

Set default radius

add_action( 'init', 'set_default_radius' );
function set_default_radius()
{
    if ( !isset($_GET['radius']) || empty($_GET['radius']) )
    {
        $_GET['radius'] = 0.5;
        $_REQUEST['radius'] = 0.5;
    }
}

Add bias towards a certain location

Some place names exist multiple times across the UK so a geocoding request might return the wrong one. To add some bias to a specific town or county, a snippet like so can be used:

add_filter( 'propertyhive_radial_search_location_lookup', 'add_radial_search_bias' );
function add_radial_search_bias($location)
{
    $location .= ', Yorkshire';
    return $location;
}