Title: Adding hidden group
Last modified: August 22, 2018

---

# Adding hidden group

 *  Resolved [branto](https://wordpress.org/support/users/branto/)
 * (@branto)
 * [7 years, 9 months ago](https://wordpress.org/support/topic/adding-hidden-group/)
 * I’ve tried adapting the functions.php code below per the discussion on the website,
   but can’t seem to get it right.
 * >  // add hidden field to top bar
   >  add_action( ‘mctb_before_submit_button’, function(){
   > echo ‘<input type=”hidden” name=”INTERESTS[3794ae7c19][]” value=”807ce58ff6″/
   > >’;
   > });
   > add_filter( ‘mctb_data’, function( $vars ) {
   >  $vars[‘INTERESTS[3794ae7c19][]’]
   > = ( isset( $_POST[‘INTERESTS[3794ae7c19][]’] ) ) ? sanitize_text_field( $_POST[‘
   > INTERESTS[3794ae7c19][]’] ) : ”; return $vars; });

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Contributor [Lap](https://wordpress.org/support/users/lapzor/)
 * (@lapzor)
 * [7 years, 9 months ago](https://wordpress.org/support/topic/adding-hidden-group/#post-10616940)
 * I see it’s a hidden field, so it’s implicit? You don’t need the field then, we
   can just set it from code in the filter, like this:
 *     ```
       add_filter( 'mctb_data', function($data) {
       	$data['INTERESTS'][] = "interest-id";
       	return $data;
       });
       ```
   
 * [https://github.com/ibericode/mc4wp-snippets/blob/master/add-ons/top-bar/add-to-interest-groups.php](https://github.com/ibericode/mc4wp-snippets/blob/master/add-ons/top-bar/add-to-interest-groups.php)
 * Hope that helps. If you have any questions, please let us know!
 *  Thread Starter [branto](https://wordpress.org/support/users/branto/)
 * (@branto)
 * [7 years, 8 months ago](https://wordpress.org/support/topic/adding-hidden-group/#post-10769738)
 * Thank you so much! This worked!
 * But now a related issue — I have checked “Update existing subscribers?” in the
   advanced settings, which causes the form to replace any existing interests with
   the interest coded into the form.
 * What I want is for the the interest coded into the form to be added to existing
   interests, not to replace them. Is this possible?
 * Thank you so much!

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Adding hidden group’ is closed to new replies.

 * ![](https://ps.w.org/mailchimp-top-bar/assets/icon-256x256.png?rev=1224622)
 * [MC4WP: Mailchimp Top Bar – Email Subscribe Notification Bar](https://wordpress.org/plugins/mailchimp-top-bar/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/mailchimp-top-bar/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/mailchimp-top-bar/)
 * [Active Topics](https://wordpress.org/support/plugin/mailchimp-top-bar/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/mailchimp-top-bar/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/mailchimp-top-bar/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [branto](https://wordpress.org/support/users/branto/)
 * Last activity: [7 years, 8 months ago](https://wordpress.org/support/topic/adding-hidden-group/#post-10769738)
 * Status: resolved