Filter: postie_gallery

This filter is called when Postie inserts a gallery shortcode into the post (which only ever happens if the “Automatically insert image gallery” setting is turned on). You can use this filter to generate an alternate gallery shortcode. At the point it is called there is only a placeholder post, e.g. the content and metadata is not set yet, however, all the media have been attached.

The $shortcode parameter is the existing shortcode (typically [gallery]).

The $postid parameter is the ID of the post.

add_filter('postie_gallery', 'my_gallery_filter', 10, 2);

function my_gallery_filter($shortcode, $postid) {
 $shortcode = "[mygallery format='flex']";
 return $shortcode;