This hook in the WP Maps Pro plugin allows developers to customize text strings and settings used in JavaScript files. It is triggered during the runtime to modify the localized script data using wp_localize_script
.
Usage
Developers can implement this hook to modify the default text strings and settings used by the WP Maps Pro plugin. It is particularly useful for changing labels, messages, and other strings that appear in the plugin’s frontend components. This customization can be done in the theme’s functions.php
file or a custom plugin.
Example 1
Change the “Find Locations” button text to “Search Locations”.
add_filter('wpgmp_text_settings', 'customize_wpgmp_text_settings'); function customize_wpgmp_text_settings($wpgmp_local) { $wpgmp_local['find_location'] = 'Search Locations'; return $wpgmp_local; }
Example 2
Modify the placeholder text for the search input field.
add_filter('wpgmp_text_settings', 'modify_search_placeholder'); function modify_search_placeholder($wpgmp_local) { $wpgmp_local['search_placeholder'] = 'Search for a location...'; return $wpgmp_local; }
Example 3
Change the “No results found” message to a custom message.
add_filter('wpgmp_text_settings', 'custom_no_results_message'); function custom_no_results_message($wpgmp_local) { $wpgmp_local['wpgmp_location_no_results'] = 'Sorry, we couldn\'t find any locations matching your search.'; return $wpgmp_local; }
Tip: Always ensure that the modifications do not interfere with the core functionality of the plugin and test changes thoroughly in a staging environment before applying them to a live site.