This is our list of filters and actions available in MailPoet for use by developers.
A Filter is a function that can be hooked to an event in WordPress (called hooks).
Need a developer to help you? We recommend those at Codeable (affiliate link).
Filters |
| mailpoet_api_newsletters_get_after |
| mailpoet_api_newsletters_save_before |
|
mailpoet_automated_latest_content_post
Customizes post data before the Automatic Latest Content widget transforms it into newsletter blocks. Receives three parameters: (1) the cloned WP_Post object to modify, (2) the original unmodified WP_Post object, and (3) the block configuration array. Must return a WP_Post object. If a non-object is returned, the original post is used as a fallback. |
| mailpoet_cron_worker_sending_queue_batch_size |
| mailpoet_display_docsbot_widget |
|
mailpoet_sending_newsletter_render_after
This filter is replaced with mailpoet_sending_newsletter_render_after_pre_process starting from MailPoet 3.98.1 |
|
mailpoet_sending_newsletter_render_after_pre_process |
| mailpoet_mailer_smtp_connection_timeout |
|
mailpoet_mailer_smtp_transport_agent (this filter is replaced with mailpoet_mailer_smtp_option starting from MailPoet 3.89.3) Sets additional transport options; mostly to modify context options for ssl:// and tls:// transports http://php.net/manual/en/context.ssl.php This is an example of how to use this filter. |
|
wpmu_registration_enabled |
| mailpoet_mailer_smtp_host |
| mailpoet_mailer_smtp_port |
| mailpoet_mailer_smtp_encryption |
| mailpoet_mailer_smtp_username |
| mailpoet_mailer_smtp_password |
| mailpoet_mailer_smtp_options |
|
mailpoet_mailer_smtp_instance |
|
mailpoet_archive_no_newsletters |
| mailpoet_archive_title |
| mailpoet_archive_email_processed_date |
| mailpoet_archive_email_subject_line |
| mailpoet_rendering_post_process |
|
mailpoet_newsletter_shortcode_link
Creates custom link shortcode that’s rendered when newsletter is sent/previewed. |
|
mailpoet_newsletter_shortcode
Creates custom shortcode that’s rendered when newsletter is sent/previewed. |
|
mailpoet_conflict_resolver_whitelist_style
Prevents third-party plugin’s JS or CSS dependencies from being unloaded. |
|
mailpoet_form_widget_post_process
Sets rendered form body before output. Used to modify form parameters (e.g., setting form’s |
|
mailpoet_newsletter_post_excerpt_length
Sets custom post excerpt size. Used when fetching posts inside Editor (ALC or regular Post block) or during rendering. |
|
mailpoet_newsletter_post_author
Changes the author line shown with a post in an email, for example to show guest authors. Receives three parameters: (1) the author line, including the label set in the block, (2) the post ID, and (3) the post author ID, which is null for WooCommerce products. Return a string. If the return value is not a string or a number, MailPoet ignores it and uses the original line. Applies to the Posts and Automatic Latest Content blocks in the Newsletter editor, including Post Notification emails. Does not apply to the Latest Posts block in the Email Editor. |
|
mailpoet_newsletter_post_categories
Changes the categories line shown with a post in an email. Receives three parameters: (1) the categories line, including the label set in the block, which is empty when the post has no categories, (2) the post ID, and (3) the post type, which is |
|
mailpoet_newsletter_show_password_protected_post_content
Includes the body or excerpt of password-protected posts and products in emails. MailPoet leaves this content out by default. Receives two parameters: (1) a boolean, false by default, and (2) the post or product object. Return true to include the content. Applies to the Posts, Products, and Automatic Latest Content blocks, and the WooCommerce product blocks, in the Newsletter editor. Example: |
|
mailpoet_permission_access_plugin_admin
Sets permission to view MailPoet/Mailpoet → Help/MailPoet → Premium/MailPoet → Welcome/MailPoet → Update pages. |
|
mailpoet_permission_manage_settings
Sets permission to view MailPoet → Settings. |
|
mailpoet_permission_manage_emails
Sets permission to view MailPoet → Emails. |
|
mailpoet_permission_manage_subscribers
Sets permission to view MailPoet → Subscribers. |
|
mailpoet_permission_manage_forms
Sets permission to view MailPoet → Forms. |
|
mailpoet_permission_manage_segments
Sets permission to view MailPoet → Segments. |
|
mailpoet_permission_update_plugin
Sets permission to activate/deactivate plugin. |
|
mailpoet_cron_request_url
Overrides default URL used to access the plugin in the background |
mailpoet_cron_request_args Overrides default arguments used by https://codex.wordpress.org/Function_Reference/wp_remote_get |
| mailpoet_subscription_before_subscribe |
Action, which fires before a subscription is stored in the database. You can use this action to intercept the subscription being stored by throwing an UnexcpectedValueException. Example:
add_action(
'mailpoet_subscription_before_subscribe',
function($data, $segmentIds, $form) {
if ($form->id() !== 10 || !in_array(21, $segmentIds)) {
return;
}
if ($data['some_custom_field'] === 'wrong') {
throw new \MailPoet\UnexpectedValueException("You can not use 'wrong' in the some_custom_field.");
}
},
10,
3
);
mailpoet_subscription_limit_enabled
mailpoet_subscription_limit_window
Overrides throttling window (IP addresses memory span). Default: DAY_IN_SECONDS
mailpoet_subscription_limit_base
Overrides throttling base timeout (the first one that gets doubled every time). Default: MINUTE_IN_SECONDS
mailpoet_segments_with_subscriber_count
Add dynamic segments on newsletters and subscribers page.
mailpoet_get_subscribers_in_segment_finders
Enables hooking a finder which can find subscribers in a dynamic segment.
mailpoet_get_subscribers_listings_in_segment_handlers
Loads listings handlers for subscribers in a dynamic segment.
mailpoet_subscribers_listings_filters_segments
Loads dynamic segment for subscribers filter.
mailpoet_transient_cache_enabled
A boolean to enable the transient cache for MailPoet. Default is true.
mailpoet_bridge_api_request_timeout
Sets timeout for Bridge API HTTP requests. Useful on slow hosts where connection times out on large HTTP requests.
mailpoet_search_terms_args
Update search terms arguments. Useful for sites with a lot of tags to prioritise categories in search.
mailpoet_manage_subscription_page_form_fields
Customize form fields displayed on the Manage Subscription page. The argument is an array of fields and their properties.
mailpoet_manage_subscription_page
Customize the template of the Manage Subscription page. The argument is a rendered HTML code of the page to be displayed.
mailpoet_unsubscribe_confirmation_page
Change confirmation sentence. The URL to confirm unsubscribing is sent as a 2nd parameter to the filter.
mailpoet_display_custom_fonts
Disable Google Fonts to stop loading it.
mailpoet_display_form_supported_post_types
Add a custom post type where forms should be displayed.
mailpoet_display_form_in_product_listing
Set whether forms should be displayed on Shop page / product listings (default to `true`)
mailpoet_re_captcha_size
It can be either normal or compact (docs).
mailpoet_captcha_session_limit
Set how many new built-in CAPTCHA sessions one network source can start in 10 minutes (default `200`). A source is one IPv4 address or one IPv6 /64 network. Raise the limit if many visitors share one IP address, for example behind a proxy. Example: add_filter( 'mailpoet_captcha_session_limit', fn() => 500 );
mailpoet_tracking_consent_copy
Change the wording of the tracking-consent checkbox at each place it appears. The filter receives the text and the place: woocommerce_checkout, registration, comment, or form. The text you return is shown to the subscriber and stored as the record of what they agreed to.
mailpoet_is_cookie_tracking_enabled
Turn MailPoet’s tracking cookies on or off, for example until a visitor accepts cookies in your cookie-consent plugin. These are the cookies MailPoet uses for engagement tracking, WooCommerce revenue, and abandoned cart emails (see Cookies Used by MailPoet). Default: true when Engagement analytics tracking in MailPoet → Settings → Advanced is set to Full, otherwise false. Example, where my_visitor_accepted_cookies() stands for your consent plugin’s check: add_filter( 'mailpoet_is_cookie_tracking_enabled', fn( $enabled ) => $enabled && my_visitor_accepted_cookies() );
mailpoet_manage_subscription_preview_subscriber_email
Change the demo email address shown when you preview the Manage Subscription page (default demo@mailpoet.com). Return a non-empty string. Any other value falls back to the default. Example: add_filter( 'mailpoet_manage_subscription_preview_subscriber_email', fn() => 'preview@example.com' );
mailpoet_delete_subscriber_on_wp_user_delete
Delete the MailPoet subscriber when its linked WordPress user is deleted. Since MailPoet 5.26.0, deleting a WordPress user keeps the subscriber: it leaves the WordPress Users list and stays on any other lists (see The WordPress Users List). Receives three parameters: (1) a boolean, false by default, (2) the subscriber, and (3) the WordPress user ID. Return true to delete the subscriber too. Example: add_filter( 'mailpoet_delete_subscriber_on_wp_user_delete', '__return_true' );
mailpoet_sending_queue_subscribers_to_process
Leave subscribers out of one send, for example to limit how many emails each subscriber gets in a week. Runs for each sending batch, after MailPoet picks the subscribers. Receives three parameters: (1) an array of the subscribers in the batch, (2) the email being sent, and (3) the sending task. Return the array without the subscribers to skip. Skipped subscribers don’t get this email. You can only remove subscribers, not add them. If the return value isn’t an array, MailPoet ignores it and sends to the whole batch. Example:
add_filter(
'mailpoet_sending_queue_subscribers_to_process',
function( $subscribers, $newsletter, $task ) {
return array_filter( $subscribers, function( $subscriber ) {
return ! my_should_skip( $subscriber->getEmail() );
} );
},
10,
3
);
mailpoet_woo_backed_revenue_reporting
Choose how MailPoet counts WooCommerce revenue (default true). Since MailPoet 5.31.0, revenue for new orders comes from WooCommerce order attribution, so it matches WooCommerce Analytics. Return false to go back to MailPoet’s own revenue tracking (see Guide to WooCommerce Revenue). Example: add_filter( 'mailpoet_woo_backed_revenue_reporting', '__return_false' );
mailpoet_allow_sending_in_non_production
Allow or block queued sending on a site that WordPress reports as staging, development or local. Receives one parameter: a boolean, true when Allow sending is checked in MailPoet → Settings → Advanced, otherwise false. Return true to send from this site. Production sites always send, so the filter has no effect there (see Your site is marked as staging, development or local). Example: add_filter( 'mailpoet_allow_sending_in_non_production', '__return_true' );
mailpoet_hold_overdue_campaigns
Turn off holding late campaigns (default true). Since MailPoet 5.44.0, a newsletter, post notification email or re-engagement email that is more than a day late and hasn’t gone to anyone is held until you confirm it (see A late campaign is waiting for your confirmation). Return false to send late campaigns without asking. Example: add_filter( 'mailpoet_hold_overdue_campaigns', '__return_false' );
mailpoet_overdue_campaign_threshold
Set how many seconds late a campaign must be before MailPoet holds it (default 86400, one day). A value of 0 or less turns holding off. Example, to hold only campaigns that are more than two days late: add_filter( 'mailpoet_overdue_campaign_threshold', fn() => 2 * DAY_IN_SECONDS );
Actions |
| mailpoet_initialized |
| mailpoet_api_setup |
| mailpoet_setup_reset |
|
mailpoet_api_newsletters_duplicate_after |
| mailpoet_api_newsletters_save_after |
|
mailpoet_conflict_resolver_styles |
| mailpoet_conflict_resolver_scripts |
| mailpoet_conflict_resolver_router_url_query_parameters |
| mailpoet_subscriber_created |
|
mailpoet_subscriber_updated |
| mailpoet_subscriber_deleted |
| mailpoet_multiple_subscribers_created |
| mailpoet_multiple_subscribers_updated |
| mailpoet_multiple_subscribers_deleted |
| mailpoet_subscriber_tracking_consent_changed (subscriber ID, old consent, new consent: granted, denied, or unknown) |
| mailpoet_subscription_after_subscribe (subscriber, submitted form data, list IDs, form): fires after someone subscribes through a MailPoet form |
| mailpoet_subscription_confirmed (subscriber): fires when a subscriber clicks the link in the confirmation email |
| mailpoet_segment_subscribed (subscriber’s list subscription): fires when a subscriber is subscribed to a list. The Add to list and Move to list bulk actions on the Subscribers page fire it only when Trigger automations is checked, once for each subscriber newly added to the list |
| mailpoet_segment_unsubscribed (subscriber’s list subscription): fires when a subscriber is unsubscribed from a list. Unsubscribing from all lists fires it once for each list |
MailPoet Premium
Filters |
| mailpoet_newsletters_listing_stats_before |
| mailpoet_newsletters_listings_standard_actions |
| mailpoet_newsletters_listings_welcome_notification_actions |
| mailpoet_newsletters_listings_notification_history_actions |
| mailpoet_newsletters_3rd_step_fields |
| mailpoet_newsletters_types |
| mailpoet_newsletters_listings_welcome_notification_actions |
| mailpoet_api_newsletters_save_before |
| mailpoet_api_newsletters_get_after |
| mailpoet_sending_newsletter_render_after |