Newsletters: Filter Reference
The WordPress Newsletter plugin will fire filter hooks throughout its code so that you can hook with custom filters onto these filters hooks while receiving parameters and apply your own functions.
It works exactly like the WordPress Plugin API/Filter Reference by using the apply_filters()
function and the filter hooks are used in the same manner as that of WordPress.
This filter reference is constantly updated with new filter hooks as the plugin is updated so search here or request a new filter hook if you’re looking for something specific.
Subscribers
wpml_subscriber_validation
– Filters the error messages just before a subscriber is saved, after internal validation. Arguments: $errors, $datanewsletters_admin_subscribers_table_columns
– Filter the columns of the subscribers table in admin.wpml_subscriber_add_new
– Default value is true and has no arguments. Only use if you want to programmatically avoid allowing users to subscriber. Use case: honeypots. I.e., add_filter with no args and change the value to ‘false’ if the honeypot input filter has been filled (using a bot).
Mailing Lists
wpml_mailinglists_select
– Filters the select drop down menu of mailing lists used in both the back-end and front-end. Arguments: $mailinglistswpml_mailinglist_validation
– Filters the error messages when saving a mailing list. Arguments: $errors, $data
Sent & Draft Emails
wpml_admin_history_rsslink
– Filter to show/hide the RSS link under Newsletters > Sent & Draft Emails. Arguments: $show (true)wpml_admin_history_exportlink
– Filter to show/hide the export link/button. Arguments: $show (true)wpml_admin_history_authorcolumn
– Filter to show/hide the author column in the table . Arguments: $show (true)
Custom Fields
newsletters_validation_rules
– Filters the predefined validation rules which are available for custom fields. Arguments: $validationrules
Email Themes
wpml_themes_select
– Filters the select drop downs and radio button lists for email themes used throughout the plugin in the back-end and front-end. Arguments: $themesselect
Additional Content Areas
newsletters_content_defaults
– Filters the default values in the model of the additional content areas which can be added to newsletters. Arguments: $defaultsnewsletters_content_validation
– Filters the error messages when saving an additional content area. Arguments: $errors, $data
Email Queue
wpml_queue_validation
– Filters the error messages when saving a queue item/email/row before saving, after internal validation. Arguments: $errors, $subscriber, $subject, $message, $attachments, $post_id, $history_id, $return_query, $theme_id, $senddate
Email Filters
wpml_send_body
– Filters the body/content of the email just before it is sent. Arguments: $body, $phpmailer, $history_idwpml_sendmail_validation
– Filters the error messages before an email is sent, after internal validation. Arguments: $errors, $validationdatawpml_post_thumbnail_img_style
– Filters the inline style string of the post thumbnail images in the newsletter post content.wpml_post_anchor_style
– Filters the inline style string of the post title links in the Newsletters post content.newsletters_emailbody_links
– Filters the a href links in newsletters before the email is sent so that you can modify links/URLs.wpml_bitlink_loop
– Filter before a link goes through to the Bit.ly link creator. You can use this to prevent specific links from being shortening. Arguments: $shorten (true), $link, $matcheswpml_hashlink_loop
– Filter before a link goes through the built-in link/click tracking generator. You can use this to prevent a specific link from being shortening. Arguments: $shorten (true), $link, $matcheswpml_wpmlcontent_before_replace
– Filters the email/newsletter body before the [wpmlcontent] tag is replaced with the content from the editor. Arguments: $bodywpml_wpmlcontent_after_replace
– Filters the email/newsletter body after the [wpmlcontent] tag has been replaced with the content from the editor. Arguments: $bodywpml_online_newsletter
– Filters the online newsletter which is displayed to a subscriber when the subscriber clicks the view online link. Arguments: $content, $subscriberwpml_phpmailer_before_send
– Filters the PHPMailer object before calling the PHPMailer::send() method. Argument: $phpmailer (the PHPMailer instance)wpml_disable_wpautop_on_mail_rendering
– Disables autop in email rendering.
Extensions Filters
wpml_extensions_list
– Applied to the extensions list which is fetched. Arguments: $extensions
Script Loader
- Unload Newsletter JavaScript from all over the website. Related article. Please note that adding the below can be dangerous. You should only do this if you know what you are doing. This option is will remove the external JS files and localized JavaScripts necessary to submit the newsletter’s subscription or unsubscription forms using Ajax.
add_filter( 'wpmlloadscripts', 'wpmlloadscripts_callback' );
function wpmlloadscripts_callback( $execute ) {
// Set $execute to false to prevent code execution
$execute = false;
// Return the modified value of $execut
return $execute;
}
Beautiful Newsletter Templates
Professional newsletter templates that are fully responsive for desktop, tablet, and mobile. They are 100% cross-client compatible.