Home / Admin / How to Change the Error Text for Failed Submissions
Duplicate Snippet

Embed Snippet on Your Site

How to Change the Error Text for Failed Submissions

This code snippet changes the error text that shows to your visitors on failed submissions.

<10
Code Preview
php
<?php
/**
* Change the error text message that appears.
*
* @link https://wpforms.com/developers/how-to-change-the-error-text-for-failed-submissions/
*/
function wpf_translated($translated_text, $text, $domain) {
    // Bail early if it's not a WPForms string.
    if ($domain !== 'wpforms-lite') {
        return $translated_text;
    }
    // Compare against the original string (in English).
    if ($text === 'Form has not been submitted, please see the errors below.') {
        $translated_text = __('Hey! Please check under the hood!', 'wpforms');
    }
    return $translated_text;
}
add_filter('gettext', 'wpf_translated', 10, 3);

Comments

Add a Comment