Support » Plugin: MailPoet 2 » [Plugin: Wysija Newsletters] Including Custom Post Types hack?

  • Resolved rendsvig84



    I’ve seen that custom post type integration is mentioned as a future development.

    Is there a chance that some ad-hoc method has been developed at this point already?

    I have only one custom post type I want included among the posts send out by the newsletter, and I do not mind messing with code (if properly guided 😉 )

Viewing 13 replies - 1 through 13 (of 13 total)
  • Hi,

    Nothing has been developed at the time, but it’s high in our list.
    Yet if you’re in hurry to get that, you can hack the plugin yourself : go to wysija-newsletters/controllers/ajax/campaigns.php and modify the function getarticles.

    Hope this helps,


    Hi Ben,

    I changed the getarticles function by modifying the code below:

    			$querystr = "SELECT $wpdb->posts.ID , $wpdb->posts.post_title, $wpdb->posts.post_content, $wpdb->posts.post_excerpt
    			FROM $wpdb->posts
    			WHERE $wpdb->posts.post_title like '%".addcslashes(mysql_real_escape_string($_REQUEST['search'],$wpdb->dbh), '%_' )."%'
    			AND $wpdb->posts.post_status = 'publish'
    			AND $wpdb->posts.post_type = 'post'
    			OR $wpdb->posts.post_title like '%".addcslashes(mysql_real_escape_string($_REQUEST['search'],$wpdb->dbh), '%_' )."%'
    			AND $wpdb->posts.post_status = 'publish'
    			AND $wpdb->posts.post_type = 'horse'
    			ORDER BY $wpdb->posts.post_date DESC
    			LIMIT 0,30";

    (my custom post type is called “horse”) … This code doesn’t seem to do anything. I don’t see that added anywhere in the drag-and-drop newsletter creator, or anywhere else for that matter. Did I get it wrong? Thanks for the help!

    I’m no coder but I can see an obvious line that would need to be changed – line 6 has another reference to the post type which would need to be changed to horse.

    as of version 2.1.6 no need to hack the plugin for CPT support anymore.
    Try it and don’t forget to give us feedback on

    Good one Ben

    I was wondering whether there’s a way to trigger an auto newsletter for a custom post type ONLY when a new post for that custom post type is published?

    My wife runs her own site for her artwork and would like to send updates for new published work, for only new portfolio items.

    Is this something that can be done now or needed functionality required?

    Thanks Martin,
    Yes it should work now.
    The same way it was working for standard posts.
    Simply select the post you want in your filters for Automated posts, see the screenshot here:

    Cool Ben,

    Is there any reason why I’m unable to filter on Category like I can for ‘Posts’ post type?

    I’d like to avoid sending out emails for when an artwork is moved from ‘Available’ to ‘Sold’ and I see the example the newsletter is using is one from ‘Sold’ – this newsletter is only for Available which is a category for this custom post type.

    Maybe this is a typo in the code.

    Is there a way to include a different pre-generated photo size? Like a thumbnail or a custom size set in the functions file? Seems like it’s pulling the large image (?) which might cause some emails to take a long time to be sent.

    BTW, THANK YOU for this update!!! awesomesauce!!!!

    Hi Ben,

    The custom posts problem still persists. Can you help us please to change the get_articles() function such that the custom posts will be considered.


    Plugin Author MailPoet


    Jockship, please get in touch via our site:

    Make sure you redescribe exactly what exactly you’re looking for.

    If any body want to set custom post type to be the default in the popup modal ,

    Just change the $cpt variable to your custom post, line 288 – controllers/ajax/campaigns.php

    my custom post type is called “machine”

    $query_cpt = ‘ ‘.$wpdb->posts.’.post_type=”‘.$cpt.'”‘;


    $query_cpt = ‘ ‘.$wpdb->posts.’.post_type=”machine”‘;

    I’m not sure if I should maybe make this a new separate forum entry, but it’s related so here goes: What about custom taxonomies? Is it just as easy to add those?

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘[Plugin: Wysija Newsletters] Including Custom Post Types hack?’ is closed to new replies.