Banana
A simplified, no-bloat WP plugin for the Mailchimp API
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/tdude/banana/archive/refs/heads/main.zipReadme
Banana (WordPress Plugin)
Banana is a lightweight WordPress plugin that renders a shortcode-based form and submits entries directly to a Mailchimp Audience via the Mailchimp API.
For site owners / editors
Install
-
Upload the
bananafolder to:wp-content/plugins/ -
In WordPress admin, go to:
Plugins -> Installed Plugins -
Activate Banana.
Configure Mailchimp
-
In WordPress admin, go to:
Tools -> Banana -
Fill in:
- Mailchimp API key
- Datacenter (example:
us1,us18,eu1) - Audience (List) ID
- Double opt-in (optional)
- Success message (optional)
-
Save changes.
Use the form
Add the shortcode anywhere you want the form to appear:
[banana_form]
What the form collects
The form sends these fields to Mailchimp:
EMAIL(required)NAMETITLEMESSAGE
These are sent as Mailchimp merge fields:
FNAME<-NAMETITLE<-TITLEMESSAGE<-MESSAGE
Basic anti-abuse protections
Banana includes low-friction spam/abuse protections:
- Honeypot field (
website) - Nonce verification
- Lightweight rate limiting (short bursts)
If someone submits too many times in a short period, they will see a “try again later” message.
Developer notes
File structure
banana.phpcontains the full plugin implementation.
Admin page
-
Settings page is registered under
Tools -> Bananaviaadd_management_page(). -
Settings are stored in a single option:
- Option key:
banana_options
- Option key:
Shortcode
- Shortcode:
[banana_form] - Handler:
banana_render_form_shortcode()
Hooks / extension points
Banana provides a few filters to integrate additional protection or custom merge field behavior:
-
banana_captcha_tokenUsed to inject a CAPTCHA token into the hidden
procaptchafield. -
banana_validate_captchaUsed to validate CAPTCHA on submit.
Signature:
apply_filters('banana_validate_captcha', true, $captcha_token, $_POST)
-
banana_merge_fieldsUsed to modify merge fields before sending to Mailchimp.
Signature:
apply_filters('banana_merge_fields', $merge_fields, $context)
Where
$contextcontains:name,title,message,email
Mailchimp API behavior
-
Uses a
PUTrequest to:https://{datacenter}.api.mailchimp.com/3.0/lists/{audience_id}/members/{subscriber_hash} -
subscriber_hashis the MD5 of the lowercased email. -
Sets:
status_if_newtopendingif double opt-in is enabled, otherwisesubscribedstatustosubscribed
Rate limiting implementation
Rate limiting is implemented with transients in banana_handle_submission():
- Per-email: max
3per60s - Per-IP: max
10per60s
Transient keys:
banana_rl_email_{md5(email)}banana_rl_ip_{md5(ip)}
Translations
- Text domain:
banana