Support » Plugin: WP Mautic » Custom fields in WordPress registration form

  • Resolved danzmwl


    We have custom fields in our registration form on our website.

    This plugin saves the name / email etc from the registration form to Mautic. It also saves the username using the Mautic custom field wp_user.

    However I don’t know how to get Mautic to collect the data from the other registration form fields. What wp_ text should I be putting in the Alias field?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author shulard


    Hello !

    You can control the data sent to Mautic using the wpmautic_tracking_attributes filter.

    In your theme / plugin you can add something like this :

    add_filter('wpmautic_tracking_attributes', function($attributes) {
        $attributes['new_field'] = 'my value';
        return $attributes;

    You can add, remove or update the generated attributes before they will be sent to Mautic.

    • This reply was modified 10 months, 2 weeks ago by shulard.


    Thanks for this @shulard

    Could you please give a full-blown example of how to add this code? I have a registration form field called Country which I would like to connect to the Country field in Mautic. What would the code look like for this?

    • This reply was modified 10 months ago by danzmwl.
    Plugin Author shulard


    Hello @danzmwl,

    This can be a valid example with a field named Country :

    add_filter('wpmautic_tracking_attributes', function($attributes) {
        //We ensure the country exists to avoid sending invalid data to Mautic.
        if (isset($_POST['Country']) && !empty($_POST['Country'])) {
            $attributes['country'] = filter_var ( $_POST['Country'], FILTER_SANITIZE_STRING);
        return $attributes;

    This example will map the field in your form named Country (cf $_POST['Country']) to the field country in Mautic (cf $attributes['country']).
    This will work if your form is submitted using the POST method, but it’s the most common usage.

    This code must be added in your functions.php theme file or inside the plugin code.

    I hope this’ll help 🙂

    • This reply was modified 10 months ago by shulard. Reason: Add mention about theme / plugin edit
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Custom fields in WordPress registration form’ is closed to new replies.