Add error on Ninja Forms submit on Wordpress

180 views Asked by At

I'm trying to throw an error on the Ninja Forms form submit, but I want to throw a generic error, not a field-specific error.

If I have this code I get an error for the field id=5 but I would like the error to be generic, not applied to any field.

add_filter('ninja_forms_submit_data', 'custom_ninja_forms_submit_data');
function custom_ninja_forms_submit_data($form_data)
{
    $form_data['errors']['fields'][5] = esc_html__('Error happened', 'custom-text-domain');

    return $form_data;
}
0

There are 0 answers