Location data filter

bh_sl_location_data

Description

Filter the location data used by the plugin.

Parameters

Name Type Description
$location_data string/array The location data. If the “Over 1,000 locations?” setting under Primary Settings is set to false, this will be a JSON string. If the setting is set to true it will be an array.
$post_id integer Post ID of the current page or post the locator is on

Example

This filter is a bit more involved and while the examples below appear a bit lengthy it’s mostly just comments. The main function makes use of PHP’s array_filter function, which requires a callback function. So, as you will see there are two functions in each example. bh_sl_change_location_data iterates over the $location_data array values and bh_sl_change_location_data_callback checks each $location array for the taxonomy value.

Over 1,000 locations? in Primary Settings set to false example:

Over 1,000 locations? in Primary Settings set to true example (without json_decode):