Description
Modify error messages displayed by Gravity Forms in the WordPress admin.
Usage
1 | add_action( 'gform_admin_error_messages' , 'my_custom_function' ); |
Parameters
Parameter | Type | Description |
---|---|---|
$error_messages | array | An 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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | 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