Title: justabeginner's Replies | WordPress.org

---

# justabeginner

  [  ](https://wordpress.org/support/users/justabeginner/)

 *   [Profile](https://wordpress.org/support/users/justabeginner/)
 *   [Topics Started](https://wordpress.org/support/users/justabeginner/topics/)
 *   [Replies Created](https://wordpress.org/support/users/justabeginner/replies/)
 *   [Reviews Written](https://wordpress.org/support/users/justabeginner/reviews/)
 *   [Topics Replied To](https://wordpress.org/support/users/justabeginner/replied-to/)
 *   [Engagements](https://wordpress.org/support/users/justabeginner/engagements/)
 *   [Favorites](https://wordpress.org/support/users/justabeginner/favorites/)

 Search replies:

## Forum Replies Created

Viewing 1 replies (of 1 total)

 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Contact Form 7] email confirmation field](https://wordpress.org/support/topic/email-confirmation-field-2/)
 *  [justabeginner](https://wordpress.org/support/users/justabeginner/)
 * (@justabeginner)
 * [9 years, 7 months ago](https://wordpress.org/support/topic/email-confirmation-field-2/#post-8606528)
 * Hi yanay,
 * Firstable:
    I do not use the add_filter and function that originally come from
   the link that you gave. I use the existence add_filter and just a part of the
   given function.
 * The code should be added in the text.php file. The location of this file is in
   the directory /wp-content/plugins/contact-form-7/modules
 * Some remarks:
    Make a copy(as a backup) of your text.php file and deactivate 
   the conatct-form-7 plugin first before you make changes in the code(or you can
   also edit the code offline). Don’t forget to activate it again when you’re ready.
 * Here it comes, so just follow these 2 steps:
 * 1) search in the text.php file for the if-block statements as shown hereunder:
 *     ```
       	if ( 'email' == $tag->basetype ) {
       		if ( $tag->is_required() && '' == $value ) {
       			$result->invalidate( $tag, wpcf7_get_message( 'invalid_required' ) );
       		} elseif ( '' != $value && ! wpcf7_is_email( $value ) ) {
       			$result->invalidate( $tag, wpcf7_get_message( 'invalid_email' ) );
       		}
       	}
       ```
   
 * 2) replace all the code mentioned in 1) with the if-block statements as shown
   hereunder:
 *     ```
       	if ( 'email' == $tag->basetype ) {
       		if ( $tag->is_required() && '' == $value ) {
       			$result->invalidate( $tag, wpcf7_get_message( 'invalid_required' ) );
       		} elseif ( '' != $value && ! wpcf7_is_email( $value ) ) {
       			$result->invalidate( $tag, wpcf7_get_message( 'invalid_email' ) );
       		} elseif ( 'your-email-confirm' == $tag->name ) {
       		        if ( 'your-email-confirm' == $tag->name ) {
               		     $your_email = isset( $_POST['your-email'] ) ? trim( $_POST['your-email'] ) : '';
               		     $your_email_confirm = isset( $_POST['your-email-confirm'] ) ? trim( $_POST['your-email-confirm'] ) : '';
   
       			     if ( $your_email != "" && $your_email_confirm != "") {
       			          if ( $your_email != $your_email_confirm ) {
                   				$result->invalidate( $tag, "Are you sure this is the correct address?" );
       			          }
       			     }
       		        }
       		}
       	}
       ```
   
 * I’ve tested and it works fine.
 * By the way, don’t expect too much from me because i am just a beginner.
 * Best regards and a happy new year
    -  This reply was modified 9 years, 7 months ago by [Jan Dembowski](https://wordpress.org/support/users/jdembowski/).
      Reason: Fixed code block

Viewing 1 replies (of 1 total)