Filter: postie_include_attachment

This filter is called before Postie saves the attachment to media library. Typically you would use this filter if you wanted to prevent Postie from processing certain files. I.e. all non-image files or you could exclude all executable files or use your own whitelist or exclude all files.
Parameters:
  • $attachment – an array of information about the attachment
    • filename – the name of the file as specified in the email.
    • mimetype – the mimetype of the file.
    • data – the content of the file.
add_filter('postie_include_attachment', 'my_postie_include_attachment', 10, 2);

function my_postie_include_attachment($include, $attachment) {
    return false; //don't include any attachments
}