When we are creating drop-down with the use of contact form 7, we are facing the issues with the validation. If we take an option then in that case required validation message will not show while submitting the form because the value not blank in this case.

Sometimes to resolve this we take a blank option which look like “–“. This sign will show on front-end and it look odd when we are making a good professional website.

To resolve this just code and paste below mentioned code in your theme’s function.php file :

function my_wpcf7_form_elements($html) {
$text = '-Please Select-';
$html = str_replace('---', '' . $text . '', $html);
return $html;
add_filter('wpcf7_form_elements', 'my_wpcf7_form_elements');

After using this code first option of the drop-down will become “Please Select” in place of “–“.

Note :  Please look at the below mentioned points :

  1.  This will work for all contact forms on the website with the use of contact form 7 plugin.
  2.  Use Blank as a first option in drop-down of contact form.