The mbp_autopost_post_args filter allows you to alter the post arguments sent to Google My Business when the plugin creates an automatic post. It has 2 parameters, $args containing the post data and $location containing the GMB location ID.

Out of the box, Post to Google My Business will only auto-post “What’s New” posts. But using this filter you can make it automatically create product, event and offer posts. This is very useful if you have a plugin that manages such content and you want to automatically publish it to Google My Business.

Samples

Strip Visual Composer, Divi and other shortcodes

Visual editors such as Divi, Visual Composer and others often clutter the post content with shortcodes. The following snippet will strip out the shortcodes.

Fetch GMB image from post content

With this snippet the plugin will fetch the first image from the post content and use that as the GMB post image. This will only work for images that have been directly uploaded to that specific post (selecting a previously used image from the Media Library will not work).

Remove call to action button

Alter call to action URL

Use Yoast OpenGraph image as GMB post image