[Pro Sites] Automatically filling in Contact Form with Site Admin Email on New Site Generation

When a customer registers a new site on my network (using Pro Sites), their new site is cloned using New Blog Templates. In this template is a contact form that I would like to pre-fill the email field with the Site Admin Email that they provided during registration.

  • Matt
    • Site Builder, Child of Zeus

    In the attached example a new site was just created for a new user via Pro Sites. In this case Divi is set as the theme. What's the best way to pre-fill this Divi Contact Form email field with the Site Admin Email (ie create a custom template for this page)?

  • Adam Czajczyk
    • Support Gorilla

    Hello Matt

    I hope you’re well today and thank you for your question!

    I think the Divi Contact Form module doesn’t provide any tool for automatic “pre-filling” so if you just put the e-mail there on the “template site” that mail would be copied all over to all new sites.

    In that case, we could use a piece of custom code that would fetch site’s admin e-mail (in case there’s more than one admin it would use the “first one” – with the lowest user ID) and then assign that value to the selected field with JavaScript.

    That would have to be either added to the “function.php” file of the theme (preferably a child theme) and it would then only work for sites that are actually using that theme.

    The code would be:

    function my_set_admin_mail() {

    $uids = get_users(
    'blog_id' => get_current_blog_id(),
    'role' => 'administrator',
    'fields' => array('user_email'),
    'orderby' => 'ID',
    'order' => 'ASC',
    'number' => 1


    <script type="text/javascript">
    jQuery(function($) {
    $('#et_pb_contact_field_3_1').val('<?php echo $uids[0]->user_email; ?>');


    add_action( 'wp_footer', 'my_set_admin_mail' );

    Give it a try please but make sure first to replace


    in this line

    $('#et_pb_contact_field_3_1').val('<?php echo $uids[0]->user_email; ?>');

    with an ID of the e-mail field on of your site.

    Let me know if it worked for you, please.

    Kind regards,


Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.