wpgmp_taxonomy_separator - WP Maps Pro

15000+ live websites are using this google maps wordpress plugin.

wpgmp_taxonomy_separator

The wpgmp_taxonomy_separator hook in WP Maps Pro allows developers to customize the separator used between multiple taxonomies when displayed on a map. By default, a comma is used as a separator, but this can be modified using this hook.

Usage

Developers can implement this hook within their theme’s functions.php file or through a custom plugin to change the default taxonomy separator. The hook provides flexibility to present taxonomy data in a format that best suits the application’s needs.

Example 1

Changing the taxonomy separator to a semicolon.

add_filter('wpgmp_taxonomy_separator', function($separator, $map) {
    return '; ';
}, 10, 2);

Example 2

Using a pipe character as a separator for a specific map ID.

add_filter('wpgmp_taxonomy_separator', function($separator, $map) {
    if ($map->ID == 123) {
        return ' | ';
    }
    return $separator;
}, 10, 2);

Example 3

Appending a custom text along with the comma separator.

add_filter('wpgmp_taxonomy_separator', function($separator, $map) {
    return ', and ';
}, 10, 2);

Tip: Always ensure the separator used is appropriate for your application’s context and doesn’t interfere with other text formats or functionality. Testing in a development environment before deploying changes to a live site is recommended.

Install Plugin Now!

Buy this plugin exclusively on CodeCanyon! You’ll get free updates, full support, and if you’re not satisfied, we’ve got you covered with a 30-day money-back guarantee.