Removed "required field" reference but getting warnings

Hey, updated functions.php to remove the “required field” reference, but when I do I get the following warning above the header of the site.

I know I can suppress warnings from displaying on the site by added another customization to the functions.php file but wanted to know if there is a better/more current way to add the gravity forms modification.

How should the “constant” in the warning below be defined specifically?

Using this customization:
add_filter( ‘gform_required_legend’, ‘__return_empty_string’ );

Getting this warning:
Warning: Use of undefined constant ‘gform_required_legend’ - assumed ‘‘gform_required_legend’’ (this will throw an Error in a future version of PHP) in /home/customer/www/ on line 139


Have you attempted to add this code to the end of the functions.php file? If not, please do so and then check to see if the issue persists.

If it does, please do not hesitate to let me know.

Sorry which code are you referring to as “this”? Are you indicating something additional?

I added the standard line: add_filter( ‘gform_required_legend’, ‘__return_empty_string’ ); to the functions.php file

and get the warnings on the site once it is saved. Trying to find out if there is an updated version of the add_filter I should use instead so I don’t get the warnings.

Or maybe you were asking if I added it “at the end of the file” rather than some other location? If so, yes, it was added at the end of the file.

Please refer to the following reply for assistance: How to remove "*required field" notice and where to put the code? - #4 by faisalahammad.

I have previously provided a solution to a similar issue.

If you are getting a warning about an “undefined constant,” chances are the code was added incorrectly, or there is some other syntax error in the code. Can you please post your functions.php file somewhere in its entirety (GitHub, codeshare, pastebin, etc.) and post the link here? We can see what’s happening. Thank you