• Resolved stirltech

    (@stirltech)


    We are having a specific situation with an extremely easy fix that I would propose. Basically, we use the Event Organiser plugin which has a couple custom query args when running get_posts/WP_Query.

    It would be helpful to all future developers that would like to plug in with their custom post types with Mailpoet to include a filter in lib/Newsletter/AutomatedLatestContent.php. Right now you do have filters unsuppressed, which is great, although there is no specific way to target this call to get_posts specifically using pre_get_posts.

    What you should do is use a filter for the args like so (approx line 71 before the call to get_posts):

    $parameters = apply_filters( "mailpoet_alc_{$parameters['post_type']}", $parameters, $this->newsletter_id );

    This would allow people to filter the custom query to their needs by doing something like this:

    add_filter( 'mailpoet_alc_event', function( $parameters, $newsletter_id ) {
        if ( $newsletter_id === 1 ) {
            $parameters['group_events_by'] = 'series';
        }
        return $parameters;
    });

    If you accept pull requests I submit one myself but would be a really simple and helpful fix to many I would venture.

Viewing 1 replies (of 1 total)
  • Hi,

    You do have an interesting use case. Unfortunately adding a feature is not as simple as modifying a line or two. In addition to having to implementation, testing, and writing unit tests, we also need to document and support the new addition. At this point in time our plates are full with other priority issues. That said, we will note this down on our list of future improvements.

    Thank you for the suggestion!

    MailPoet Team.

Viewing 1 replies (of 1 total)
  • The topic ‘Add filter for get_posts params for automatic content blocks’ is closed to new replies.