25% off ProSNIPC25OFF

WPForms: Change Submit Button and Processing Text

Customizes the WPForms submit button label and the "sending" processing text shown while the form submits, via the wpforms_frontend_form_data filter.

PHPby SnipCraft
php
<?php
if ( function_exists( 'wpforms' ) && ! function_exists( 'scseed_wpf_submit_text' ) ) {
    /**
     * Overrides submit button labels for all WPForms on the site.
     * To target a specific form, add: if ( (int) $form_data['id'] !== 42 ) return $form_data;
     *
     * @param array $form_data WPForms form data array passed to the frontend.
     * @return array
     */
    function scseed_wpf_submit_text( $form_data ) {
        // Label on the button before the form is submitted.
        $form_data['settings']['submit_text'] = 'Send My Message';

        // Label shown on the button while the form is processing.
        $form_data['settings']['submit_text_processing'] = 'Sending...';

        return $form_data;
    }
    add_filter( 'wpforms_frontend_form_data', 'scseed_wpf_submit_text' );
}
#customization#forms#submit-button#ux#wpforms