Support » Fixing WordPress » contact form works in one theme, not in the other

  • Hi there,

    I hardcoded a contact form into my theme’s sidebar and it works. Now I added the exact same code to another theme and it doesn’t send the email. Any idea why?

    <?php global $current_user;
    //If the form is submitted
    if($_POST) {
    	$to = '### (Email deleted for purpose of posting)';
    	$subject = . $name . ' sent you a message!';
    	$message = $_POST['message'];
    	$name = $_POST['name'];
    	$from_email = $_POST['email'];
    	$headers = 'From: ' . $name . ' < ' . $from_email . ' >'; 
    	wp_mail( $to, $subject, $message, $headers );
    } ?>
    <form method="POST">
    <input type="hidden" name="name" id="name" value="<?php echo $current_user->display_name; ?>">
    <input type="hidden" name="email" id="email" value="<?php echo $current_user->user_email; ?>">
    <textarea name="message" id="message" rows='' cols='' placeholder="Your message..."></textarea>
    <input type="submit" name="submit" id="submit" value="Submit" />
    <div class="clear"></div>
  • The topic ‘contact form works in one theme, not in the other’ is closed to new replies.