How to Add Domains to the Email Suggestion List

Overview

Would you like to add domain names to the email address suggestion list on your form? With a small PHP snippet, you can add in your own accepted domain names to appear on this list. This tutorial will show you the PHP needed to expand this suggested list.

Implementation Options

There are two ways to change this feature:

Adding a new domain to the list

With the snippet below, domain.com will be added to the list of domains that can appear as a suggested domain.

/**
 * New domain
 *
 * @link https://wpforms.com/developers/how-to-add-domains-to-the-email-suggestion-list/
 *
 */
function wpf_dev_mailcheck_domains( $domains ) {

    $domains[] = "domain.com";

    return $domains;
}

add_filter( 'wpforms_mailcheck_domains', 'wpf_dev_mailcheck_domains' );

Now you've added a new domains to the email suggestion list

Adding a top level domain to the list

With the snippet below, the top level domain xyz will be added to the list of top level domains that can appear as a suggested top level domain.

/**
 * Top level domain
 *
 * @link https://wpforms.com/developers/how-to-add-domains-to-the-email-suggestion-list/
 *
 */
function wpf_dev_mailcheck_toplevel_domains( $domains ) {

    $domains[] = 'xyz';

    return $domains;
}

add_filter( 'wpforms_mailcheck_toplevel_domains', 'wpf_dev_mailcheck_toplevel_domains' );

And that’s it! You’ve successfully added to the email address suggestion list. Would you like to disable this feature completely? Take a look at our tutorial on How to Disable the Email Suggestion on the Email Form Field.