gform_admin_error_messages

Description

Modify error messages displayed by Gravity Forms in the WordPress admin.

Usage

add_action( 'gform_admin_error_messages', 'my_custom_function' );

Parameters

ParameterTypeDescription
$error_messagesarrayAn array of error messages to be displayed below the title on Gravity Form pages.

Examples

This example demonstrates how we can remove an error message.

add_action( 'gform_admin_error_messages', 'my_remove_error_message' );
function my_remove_error_message( $errors ) {

    // loop through our error messages
    for ( $i = count( $errors ); $i > 0; $i-- ) {

        // check if this is the error message we want to remove
        if ( $errors[$i] == __( 'Please select the fields to be exported', 'gravityforms' ) ) {
            unset( $errors[$i] );
        }

    }

    return $errors;
}

Placement

This code can be used in the functions.php file of the active theme, a custom functions plugin, a custom add-on, or with a code snippets plugin.

See also the PHP section in this article: Where Do I Put This Code?

Source Code

This filter is located in GFCommon::display_admin_message() in common.php