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, $data
  • newsletters_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: $mailinglists
  • wpml_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: $defaults
  • newsletters_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_id
  • wpml_sendmail_validation – Filters the error messages before an email is sent, after internal validation. Arguments: $errors, $validationdata
  • 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, $matches
  • wpml_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, $matches
  • wpml_wpmlcontent_before_replace – Filters the email/newsletter body before the [wpmlcontent] tag is replaced with the content from the editor. Arguments: $body
  • wpml_wpmlcontent_after_replace – Filters the email/newsletter body after the [wpmlcontent] tag has been replaced with the content from the editor. Arguments: $body
  • wpml_online_newsletter – Filters the online newsletter which is displayed to a subscriber when the subscriber clicks the view online link. Arguments: $content, $subscriber
  • wpml_phpmailer_before_send – Filters the PHPMailer object before calling the PHPMailer::send() method. Argument: $phpmailer (the PHPMailer instance)

Extensions Filters

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;
}

Earn Money by Referring People

Refer customers to us with your affiliate link and earn commission on sales from your link.

Get Started

Pin It on Pinterest