• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

RocketGeek

Home of WP-Members, The Original WordPress Membership Plugin

  • WordPress Plugins
    • WP-Members
      • FAQs
      • Quick Start
      • Documentation
      • Extensions
    • Advanced Options
      • Documentation
      • Purchase the Plugin
      • Get the Pro Bundle
    • Download Protect
      • Documentation
      • Purchase the Plugin
      • Get the Pro Bundle
    • Invite Codes
      • Documentation
      • Purchase the Plugin
      • Get the Pro Bundle
    • MailChimp Integration
      • Documentation
      • Purchase the Plugin
      • Get the Pro Bundle
    • PayPal Subscriptions
      • Documentation
      • Purchase the Plugin
      • Get the Pro Bundle
    • Salesforce Web-to-Lead
    • Security
      • Documentation
      • Purchase the Plugin
      • Get the Pro Bundle
    • Text Editor
      • Purchase the Plugin
      • Get the Pro Bundle
    • User List
      • Documentation
      • Purchase the Plugin
      • Get the Pro Bundle
    • User Tracking
      • Documentation
      • Purchase the Plugin
      • Get the Pro Bundle
    • Memberships for WooCommerce
    • WordPass
  • Blog
    • Basics
    • Tips and Tricks
    • Filters
    • Actions
    • Code Snippets
    • Shortcodes
    • Design
    • Release Announcements
  • Store
    • Cart
    • Checkout
  • Contact
  • Log In
  • Show Search
Hide Search
Home » Plugins » MailChimp Integration » MailChimp Integration Documentation » Filter Hooks » wpmem_mc_merge

wpmem_mc_merge

Description

This filter hook allows you to change the MailChimp mail merge fields (if you are using any).  The default in the add-on are first name and last name from the default first and last name fields.  If you have changed those fields, or want to use different fields for other merge values, you can do it with this filter.

Usage

add_filter( 'wpmem_mc_merge', 'my_mc_merge_filter' );
 
function my_mc_merge_filter( $merge_vars ) {
 
    /*
     * The default merge_vars, first and last name come in
     * with the $merge_vars array.  If you are adding to
     * the merge fields IN ADDITION TO those, you'll need
     * to consider that as you filter the array.
     *
     * Here is an example where I keep the existing merge
     * fields (first and last name) and add two additional
     * fields to that array. Note how I obtain the values
     * from the posted form data.
     */
     
    $my_new_field = array(
        'MC_MERGE_FIELD_1' => $_POST['wp-members-field-meta-key-1'],
        'MC_MERGE_FIELD_2' => $_POST['wp-members-field-meta-key-2'],
    );
     
    $my_new_merge = array_merge( $merge_vars, $my_new_field );
     
    return $my_new_merge;
}

Changelog

  • 1.0.0 Introduced
  • 2.0.0 Moved to object class method do_subcribe()
  • 2.0.1 Moved to get_merge_fields()

Source

wpmem_mc_merge is located in includes/class-wp-members-mailchimp.php

WP-Members MailChimp Integration

Plugin Info

Current Stable Version: 2.3.3
Minimum WordPress Version: 5.3
Tested up to WordPress Version: 6.5
Last Updated: 2024-04-06

Documentation

    • Installation
    • License Key
    • Options
    • Merge Fields
    • Interest Groups
    • Batch Operations
    • Webhooks
    • API Functions
    • Filter Hooks
    • Action Hooks
    • WP CLI Commands
    • Change Log

Support

FAQs
MailChimp plugin support

Get the Plugin

  • Purchase the Plugin
  • Get the Pro Bundle

Ready to get started?

Join Today!

© 2025 · butlerblog.com · RocketGeek is built using WordPress, WP-Members, and the Genesis Framework

  • butlerblog.com
  • WP-Members Support Subscription
  • Terms of Service
  • Privacy Policy
  • Refund Policy