Title: [Plugin: Contact Form 7] Set include_blank value diff than &#8212;
Last modified: August 20, 2016

---

# [Plugin: Contact Form 7] Set include_blank value diff than —

 *  [idovecer](https://wordpress.org/support/users/idovecer/)
 * (@idovecer)
 * [14 years, 5 months ago](https://wordpress.org/support/topic/plugin-contact-form-7-set-include_blank-value-diff-than/)
 * Is it possible to set blank value?
    Instead of default “—” to stand something
   else?
 * On one form I do have two different “—” inlcude_blank forms, which each must 
   have different value form example:
 * — > Choose languale
    — > Choose country
 * Thank you?
 * [http://wordpress.org/extend/plugins/contact-form-7/](http://wordpress.org/extend/plugins/contact-form-7/)

Viewing 5 replies - 1 through 5 (of 5 total)

 *  [kremerdesign](https://wordpress.org/support/users/kremerdesign/)
 * (@kremerdesign)
 * [13 years, 11 months ago](https://wordpress.org/support/topic/plugin-contact-form-7-set-include_blank-value-diff-than/#post-2473951)
 * Any solution for this?
 *  [bmoore2](https://wordpress.org/support/users/bmoore2/)
 * (@bmoore2)
 * [13 years, 9 months ago](https://wordpress.org/support/topic/plugin-contact-form-7-set-include_blank-value-diff-than/#post-2473955)
 * I ran into the same issue…there should really be more options for what you want
   your blank value to be…but I suppose they are trying to keep this plugin as simple
   to use as possible.
 * **Solution:** I went into your plugins directory wp-content/plugins/contact-form-
   7/modules/select.php
 * **This file I edited at line 65 which reads:** array_unshift( $labels, ‘—‘ );
   **
   Change this line to read:** array_unshift( $labels, ‘Whatever Label You Want’);
 * BOOM: New include_blank text to whatever you want.
 *  [Ov3rfly](https://wordpress.org/support/users/ov3rfly/)
 * (@ov3rfly)
 * [13 years, 7 months ago](https://wordpress.org/support/topic/plugin-contact-form-7-set-include_blank-value-diff-than/#post-2473962)
 * It is better to change the default `---` **without hacking** the plugin php files.
 * Add one of the following solutions to your `functions.php`:
 * Simple solution: Replace all `---` in all forms with the same `Please select...`
   text:
 *     ```
       function my_wpcf7_form_elements($html) {
       	$text = 'Please select...';
       	$html = str_replace('<option value="">---</option>', '<option value="">' . $text . '</option>', $html);
       	return $html;
       }
       add_filter('wpcf7_form_elements', 'my_wpcf7_form_elements');
       ```
   
 * Complex solution: Replace `---` of known select elements with a different text
   each, you need the names like `menu-569` from `[select menu-569 include_blank...]`
   shortcode for this:
 *     ```
       function my_wpcf7_form_elements($html) {
       	function ov3rfly_replace_include_blank($name, $text, &$html) {
       		$matches = false;
       		preg_match('/<select name="' . $name . '"[^>]*>(.*)<\/select>/iU', $html, $matches);
       		if ($matches) {
       			$select = str_replace('<option value="">---</option>', '<option value="">' . $text . '</option>', $matches[0]);
       			$html = preg_replace('/<select name="' . $name . '"[^>]*>(.*)<\/select>/iU', $select, $html);
       		}
       	}
       	ov3rfly_replace_include_blank('menu-569', 'Choose language', $html);
       	ov3rfly_replace_include_blank('menu-614', 'Choose country', $html);
       	return $html;
       }
       add_filter('wpcf7_form_elements', 'my_wpcf7_form_elements');
       ```
   
 *  [chryaner](https://wordpress.org/support/users/chryaner/)
 * (@chryaner)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/plugin-contact-form-7-set-include_blank-value-diff-than/#post-2473963)
 * Hey Ov3rfly,
    Thanks for your help.
 * Im using your script to change the “—” in my form, but when im trying to put 
   two form in the same page, im getting the message-
    `Fatal error: Cannot redeclare
   ov3rfly_replace_include_blank() (previously declared in /home/orkbu/domains/gil.
   beastserv.com/public_html/hava/wp-content/themes/theme951/GetresForm.php:115)
   in /home/orkbu/domains/gil.beastserv.com/public_html/hava/wp-content/themes/theme951/
   GetresForm.php on line 115`
 * how can i overcome this issue?
 *  [chryaner](https://wordpress.org/support/users/chryaner/)
 * (@chryaner)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/plugin-contact-form-7-set-include_blank-value-diff-than/#post-2473964)
 * I managed to fix this by taking the “ov3rfly_replace_include_blank”
    function
   out of the “my_wpcf7_form_elements” function
 * there is no reason to place a function inside function in this case.
 * hope that will be helpful for someone one day.

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘[Plugin: Contact Form 7] Set include_blank value diff than —’ is closed
to new replies.

 * ![](https://ps.w.org/contact-form-7/assets/icon.svg?rev=2339255)
 * [Contact Form 7](https://wordpress.org/plugins/contact-form-7/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/contact-form-7/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/contact-form-7/)
 * [Active Topics](https://wordpress.org/support/plugin/contact-form-7/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/contact-form-7/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/contact-form-7/reviews/)

## Tags

 * [change](https://wordpress.org/support/topic-tag/change/)
 * [different](https://wordpress.org/support/topic-tag/different/)
 * [include_blank](https://wordpress.org/support/topic-tag/include_blank/)

 * 5 replies
 * 5 participants
 * Last reply from: [chryaner](https://wordpress.org/support/users/chryaner/)
 * Last activity: [13 years, 6 months ago](https://wordpress.org/support/topic/plugin-contact-form-7-set-include_blank-value-diff-than/#post-2473964)
 * Status: not resolved