wpgmp_plugin_extra_fields - WP Maps Pro

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

wpgmp_plugin_extra_fields

This hook in the WP Maps Pro plugin allows developers to customize functionality at runtime by adding or removing extra fields when saving plugin settings. It is particularly useful for modifying the data fields available in the plugin.

Usage

Developers can implement this hook within their theme’s functions.php file or a custom plugin. It’s triggered during the process of saving plugin settings, and it provides an opportunity to dynamically modify the extra fields associated with the plugin.

Example 1

This example demonstrates how to add a new custom field, “Fax No”, to the existing extra fields.

add_filter('wpgmp_plugin_extra_fields', function($extra_fields) {
    $extra_fields[] = 'Fax No';
    return $extra_fields;
});

Example 2

In this example, we remove the “Website” field from the extra fields array.

add_filter('wpgmp_plugin_extra_fields', function($extra_fields) {
    $key = array_search('Website', $extra_fields);
    if ($key !== false) {
        unset($extra_fields[$key]);
    }
    return $extra_fields;
});

Example 3

This example shows how to replace the “Email” field with a “Contact Email” field.

add_filter('wpgmp_plugin_extra_fields', function($extra_fields) {
    $key = array_search('Email', $extra_fields);
    if ($key !== false) {
        $extra_fields[$key] = 'Contact Email';
    }
    return $extra_fields;
});

Tip: Always ensure the integrity of your data by validating and sanitizing inputs to avoid potential security vulnerabilities.

Related Hooks

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.