groundhogg/form/submission_handler/contact_args

πŸ“… Published on

πŸ“ Last updated

Documentation

Β»

Filter Hooks

Β»

groundhogg/form/submission_handler/contact_args

Filters the contact creation arguments assembled from a form submission, just before the contact record is created or updated. Use this to modify or normalise field values.

apply_filters( 'groundhogg/form/submission_handler/contact_args', $args );

You will receive the associative array of contact arguments (e.g. first_namelast_nameemail).

Example

add_filter( 'groundhogg/form/submission_handler/contact_args', 'my_extension_normalise_phone' );

/**
 * Normalise the phone number format before the contact is created.
 *
 * @param array $args
 *
 * @return array
 */
function my_extension_normalise_phone( $args ) {
    if ( ! empty( $args['phone_number'] ) ) {
        $args['phone_number'] = my_extension_format_phone( $args['phone_number'] );
    }

    return $args;
}

Was this helpful?

Let us know if this document answered your question. That’s the only way we can improve.