How to Disable Content Plugins in a MailPress Newsletter

Many WordPress plugins register the_content filters that alter your posts in some way, like adding bookmarking icons at the bottom of a post, or Google +1 buttons without you having to edit your theme. This is particularly helpful when you change themes, and some plugins make dynamic content modifications that you couldn't do by editing your theme anyway.

MailPress runs these filters when generating your newsletter so that the post looks the same in your newsletter as it does on your site. However, email programs often have bizarre limitations on what they are able to display and sometimes plugins generate content that looks fine in a web browser but doesn't look good at all in email. For example, the SexyBookmarks icons turn into a list of bookmarking links which look way less than sexy when viewed in Windows Live Mail.

When you use a plugin which generates content that doesn't look good in email, you can stop it from running by removing its the_content filter when the newsletter is generated. Do this by finding out the name of the filter the plugin registers and adding a remove_filter call to your MailPress theme as follows:

Firstly, identify which plugin is generating the problematic output. Try opening the email source and looking for the output that is causing the problem along with some tell-tale indicators of which plugin it might be. In Windows Live Mail you right-click the email and select Properties → Details → Message source. Or, try disabling all plugins except MailPress, and then enabling plugins one-by-one while doing MailPress tests in the post editor until the problem appears.

Once you know which plugin is causing the problem, open it in a text editor like Notepad or Textpad, or in the WordPress dashboard Plugins → Editor. Look for an add_filter call that looks like this example from SexyBookmarks:

add_filter('the_content', 'shrsb_position_menu');

If the plugin is complex and has many files, the call may not be in the first file you look at. Textpad's Search → Find In Files option is handy here; just remember to enable Search subfolders.

In the example above, shrsb_position_menu is the content filter you want to disable. In your MailPress theme, add a remove_filter call to the top of _loop.php and plaintext/_loop.php just after the <?php header:

/* disable content filters from plugins that do not generate emailable HTML */
remove_filter('the_content', 'shrsb_position_menu'); /* SexyBookmarks */

The second parameter should be whatever function the plugin registered in the add_filter call.

Here are the lines I've added to my MailPress theme to disable the content filters which don't generate email-able output from the WordPress plugins I recommend:

remove_filter('the_content', 'shrsb_position_menu'); /* SexyBookmarks */
remove_filter('the_content', 'wp_insert_filter_content'); /* WP-Insert */

Liked this post? Subscribe to get more like it via email.

About Graham

I'm the creator of
This entry was posted in MailPress and tagged , , . Bookmark the permalink.

4 Responses to How to Disable Content Plugins in a MailPress Newsletter

  1. Geoff says:

    First up, thanks Graham for all the resources here on the site.

    Was wondering if you had gotten this method to work with Add2Any? I can't seem to get rid of the pesky share buttons on any of the newsletters.

    I think the offending filter is:
    remove_filter('the_content', 'A2A_SHARE_SAVE_add_to_content');

    But this doesn't remove it in either my theme or in plaintext. Any ideas would be appreciated.

    • Geoff says:

      Nevermind, the original add_filter function had a priority value assigned to it. To remove, the same priority had to be added to the remove_filter function.

      remove_filter('the_content', 'A2A_SHARE_SAVE_add_to_content', 98);

      Fixed it.

  2. Mildred says:

    Please i wish to show only titles or posts in my daily category emails to subscribers, how can i configure this?

Comments are closed.