Support » Plugin: Contact Form 7 » use a tag to refer to site/blog admin email

  • Resolved dcmouser


    I would love to be able to use some kind of tag in the mail configuration of a form in the TO field to be able to specify that the form submission email should get sent to whatever the currently configured site admin email is for the blog; something like [admin_email].

    This would be useful in two scenarios. First, so that if the site admin email is changed I don’t have to remember to go to every form and change the emails there.

    Second, when cloning sites in a multi-user blog so that the contact form is still valid when copied to new sites.


    • This topic was modified 2 years, 1 month ago by dcmouser.
Viewing 6 replies - 1 through 6 (of 6 total)
  • Anyone?



    Try this:

    add_filter( 'wpcf7_special_mail_tags', 'my_wpcf7_special_mail_tags', 10, 2 );
    function my_wpcf7_special_mail_tags( $value, $tag ) {
    	if ( 'admin_email' == $tag ) {
    		return get_option( 'admin_email' );
    	return $value;

    You can add it to functions.php of your site’s theme.

    That sounds like a great solution Sally, I will try it!
    Thank you.

    A quick report — it seems to work, but contactform7 complains loudly and displays error indicators in a few places because the email address specified as a tag [whatever] is reported as a malformed email address.

    I found the solution, following up on Sally’s initial suggestion there is a nice filter to check for email validity, wpcf7_is_email.
    A custom version of that lets me say that the special email tags are valid.
    Thanks again, Sally!



    No problem. =)

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘use a tag to refer to site/blog admin email’ is closed to new replies.