As will be obvious from my post, I don’t know much about coding. I am trying to get rid of the " *required field" notice at the top of my form. I searched the community, and found this thread, which has a solution.
But for the life of me, I cannot work out where this code needs to go. I am using a Divi Child theme. I also have a gravity forms styler plugin uploaded.
I have tried pasting the code in these places (in turn, obviously, not all at the same time):
-The CSS section in the general settings of the Form Styler plugin
-The “Additional CSS” box at the bottom of the WP customiser options
-The Divi Theme Editor
None of it makes any difference. The message stays. I’m out of ideas… please could someone advise? Many thanks.
It sounds like you’re on the right track with using a filter to remove the required field notice. The code you’re using is correct, but you must add it to your theme or child theme’s functions.php file.
It is best to create a child theme to ensure your changes are not lost when the theme is updated. Here are the steps to add the code to your functions.php file:
Log in to your WordPress dashboard and go to Appearance > Theme Editor.
In the Theme Editor, find the functions.php file in the list of theme files on the right-hand side.
If it exists, open the functions.php file and paste the code at the bottom, just before the closing PHP tag (?>).
Save the functions.php file.
This should remove the required field notice from your form. If it doesn’t work, ensure the code is correctly formatted and there are no syntax errors.
By creating a child theme, you can customize your site without worrying about losing them when you update the theme.
Thank you very much! I’m using a child theme in any case and I can find the functions file via ftp. I just didn’t know where to put it. Thanks so much, I’ll report back if it did the job.
Sure, take your time, and let me know how it goes! Here’s an example to help you insert your code into the functions.php file.
<?php
// code
// code
// code
// and
// lots of codes
// your new code
add_filter( 'gform_required_legend', function( $legend, $form ) {
return '* indicates required fields';
}, 10, 2 );
// ---- OR ----
add_filter( 'gform_required_legend', '__return_empty_string' );
// make sure to put it before the end of the line
?>