Skip to content

Snippet: Change the Contact Form Element “to” Adress

Important: You can now do this via the Theme Panel without any custom code!

By default the Total theme contact form element uses the site admin email address for the "to" email address and this can be modified from the main Theme Panel, however, if you wish to dynamically modify the value it is possible using a filter. This may be something you want to do if you have multiple contact forms on the site and you want them to go to different people, for example if you add a contact form to all your staff member posts you could use this filter to modify the "to" address so it goes to the staff member's email instead.

/**
 * Modify the contact form "to" address.
 *
 * @link https://total.wpexplorer.com/docs/snippets/contact-form-to-address/
 */
add_filter( 'vcex_contact_form_mail_to_address', function() {
   return 'your-custom-email@somewhere.com';
} );
All PHP snippets should be added via child theme's functions.php file or via a plugin. We recommend Code Snippets (100% Free) or WPCode (sponsored)
Back To Top