AgentWP

  • Tutorials
  • Themes
  • Plugins
  • Services
  • Contact

How To Remove Captcha From Elegant Themes Contact Page Template

If you create a contact page in a theme from Elegant Themes using its built in contact page template, then it has a captcha by default.

If you are sure that you will not get much spam from the contact form, then you may want to remove the captcha field to increase the usability of contact page.

Its really easy to remove the captcha field from the built in contact form. Open the page-contact.php file. This file is located in your theme folder. Then find and delete the following four code snippets from it.

<div id="et_contact_right">
                        <p class="clearfix">
                           <?php
                              _e('Captcha: ','Professional');  
                              echo '<br/>';
                              echo esc_attr($et_first_digit) . ' + ' . esc_attr($et_second_digit) . ' = ';
                           ?>
                           <input type="text" name="et_contact_captcha" value="<?php if ( isset($_POST['et_contact_captcha']) ) echo esc_attr($_POST['et_contact_captcha']); ?>" id="et_contact_captcha" class="input" size="2" />
                        </p>
                     </div> <!-- #et_contact_right -->
if ( !isset($_POST['et_contact_captcha']) || empty($_POST['et_contact_captcha']) ) {
         $et_error_message .= '<p>' . __('Make sure you entered the captcha. ','Professional') . '</p>';
         $et_contact_error = true;
      } else if ( $_POST['et_contact_captcha'] <> ( $_SESSION['et_first_digit'] + $_SESSION['et_second_digit'] ) ) {        
         $et_numbers_string = $et_regenerate_numbers ? __('Numbers regenerated.') : '';
         $et_error_message .= '<p>' . __('You entered the wrong number in captcha. ','Professional') . $et_numbers_string . '</p>';
         
         if ($et_regenerate_numbers) {
            unset( $_SESSION['et_first_digit'] );
            unset( $_SESSION['et_second_digit'] );
         }
         
         $et_contact_error = true;
      } else
if ( isset($_SESSION['et_first_digit'] ) ) unset( $_SESSION['et_first_digit'] );
      if ( isset($_SESSION['et_second_digit'] ) ) unset( $_SESSION['et_second_digit'] );
if ( !isset($_SESSION['et_first_digit'] ) ) $_SESSION['et_first_digit'] = $et_first_digit = rand(1, 15);
   else $et_first_digit = $_SESSION['et_first_digit'];
   
   if ( !isset($_SESSION['et_second_digit'] ) ) $_SESSION['et_second_digit'] = $et_second_digit = rand(1, 15);
   else $et_second_digit = $_SESSION['et_second_digit'];

That’s it. Now you will not see the captcha on the contact form.

Comments

  1. Haris:

    How to replace it with ReCaptcha?

  2. John:

    How do i make the phone number field mandatory ?

  3. Lee:

    How do you custom manage the custom form to include more than just the email and name?

  4. Roman:

    Hi, I have The Professional theme from elegant on my web site. I want use page contact form, but I have problem with it. When someone send message from contact form I never receive an email. I have right email in page options but it still not work. Please help. Sorry for my english.

  5. Mayur Somani:

    @Haris, @John @Lee

    Please post your question on Elegant Themes support forum and I’ll assist you there.

    @Roman

    Its probably an issue with your web host. Please contact your web host and ask them if the php mail() function is configured properly.

Get useful WordPress related tricks, tips, tutorials and reviews delivered straight to your inbox.

StudioPress - Premium Wordpress Themes
ElegantThemes - Premium Wordpress Themes

Copyright © 2023 · AGENTWP · All Rights Reserved

Copyright © 2023 · awp on Genesis Framework · WordPress · Log in