Add List Choice to Registration Form

List choice a user gets subscribed to, can be selected from “MailChimp for WP > Checkboxes”. However with few lines of code you can also provide the option to your end user to select which list they wish to subscribe to.

Follow these steps to add List choice to your Registration form:

  1. Login to your WordPress Dashboard.
  2. Go to MailChimp for WP > Forms and click on Create New Form.
  3. From the Add new field option, select List Choice. This will immediately show the code required to display the List options.
  4. Copy the generated HTML code and paste it inside a function like the one below. Make sure you replace ListIDgoeshere with your own List ID!
  5. Place the function inside your functions.php file.
function myprefix_show_list_choice_in_registration() {
	?>
	<h4>Choose the lists you wish to subscribe to..</h4>
	<p>
		<label>
			<input type="checkbox" name="_mc4wp_lists[]" value="ListIDgoeshere" />List 01
		</label>
		<label>
			<input type="checkbox" name="_mc4wp_lists[]" value="ListIDgoeshere" />List 02
		</label>
		<label>
			<input type="checkbox" name="_mc4wp_lists[]" value="ListIDgoeshere" />List 03
		</label>
	</p>
	<?php
}

add_action( 'register_form', 'myprefix_show_list_choice_in_registration' );

You users can now select the list they wish to subscribe to. You can also add the List choice option to the Comment form.

You can also use radio buttons to limit the list choice to 1. Lean how to replace checkboxes with radio buttons.

Was this article helpful? ·