how to integarte mailchimp on wordpress

How to Integrating Mailchimp Into Your WordPress Site

Integrating Mailchimp into your WordPress site without a plugin can be done by following these steps:

Create a Mailchimp account: If you haven’t already, create a free account on Mailchimp.

Create a new audience: An audience is a group of contacts who have opted to receive your email campaigns. Create a new audience by clicking on the “Audience” tab and selecting “Create Audience.”

Generate an API key: To connect your WordPress site to Mailchimp, you’ll need an API key. Go to your account settings and select “API keys” to generate a new key.

Add Mailchimp to your WordPress site: Open the functions.php file in your WordPress theme and add the following code snippet:

function add_mailchimp_to_form($atts, $content = null) {
$api_key = 'YOUR_API_KEY_HERE';
$list_id = 'YOUR_LIST_ID_HERE';
$result = '';
$result .= '<form action="" method="POST">';
$result .= '<input type="hidden" name="u" value="'.$list_id.'" />';
$result .= '<input type="hidden" name="id" value="'.$list_id.'" />';
$result .= '<input type="email" name="EMAIL" placeholder="Your Email" required />';
$result .= '<input type="submit" value="Subscribe" />';
$result .= '</form>';
return $result;
add_shortcode('mailchimp', 'add_mailchimp_to_form');

Customize the code snippet: Replace “YOUR_API_KEY_HERE” and “YOUR_LIST_ID_HERE” with your API key and audience ID, respectively.

Add the shortcode to your WordPress site: To add the Mailchimp form to your WordPress site, create a new post or page and use the following shortcode:


Save and test: Save your changes and test the form to make sure it’s working correctly.

That’s it! You’ve successfully integrated Mailchimp into your WordPress site without a plugin.