WordPress to Instagram, Google Business Profile and more with Zapier (Free & Automatic)

If you are a blogger, entrepreneur, marketer or digital marketer using WordPress, you know how crucial it is to share your new articles on social media to maximize their reach. Especially since AI has reversed the direction of content creation, by re-prioritizing content published on brand sites. But manually posting to Instagram, Google Business Profile, and other platforms can be time-consuming. Fortunately, with Zapier, you can automate this process for free (within certain limits) and simplify your digital marketing strategy. In this article, I will show you:

  • how I automatically relays my articles WordPress to Instagram, Google Business Profile, and even other social networks, using a simple and effective method, without third-party plugins and without paying;
  • how I sets the length of the excerpt ;
  • and how I allow the automatic cutting of the extract at the end of a sentence for a natural look.

This method allows me to offer deals and communicate about new products from my brands, all while centralizing everything from my WordPress sites. Follow this step-by-step tutorial!

Why automate sharing your WordPress articles?

  • Save time: No more manually copying and pasting your articles on each platform.
  • Consistency: Ensure a regular presence on your social networks.
  • Increased reach: Reach your audience where they are, whether on Instagram, Google Business Profile, or elsewhere.
  • For SEO but also AIO: by publishing regularly from your website to social platforms, you put your website back at the center of your digital strategy, which goes in the direction of the great return to SEO via AI, and these are topics I cover in my special guide “SEO for AI”.

Example

To give you a quick idea of what it can be like, Here is an article written on the blog of my restaurant business, relayed here automatically on Instagram And here on Google Business Profile, without having to publish anything on these platforms.

Prerequisites

Before you begin, make sure you have:

  • A WordPress blog, which will become the nervous system of your web communication.
  • An Instagram Business account (required to publish via Zapier).
  • A Google Business Profile account connected to your establishments.
  • An account Zapier (the free version is sufficient for this tutorial, with a limit of 100 tasks per month, which is more than enough for a business, a restaurant, etc.).

Zapier offers a free plan that allows up to 100 tasks per month (one task = one action performed, such as an Instagram post). This should be enough for a blog with a few monthly posts.

Step 1: Customize your WordPress post excerpt with excerpt.raw

To enable Zapier to share a clean, optimized excerpt of your posts, we'll customize the excerpt in the WordPress REST API by adding an excerpt.raw (plain text) field. This eliminates the need to clean up HTML tags in Zapier.

Create a dedicated snippet to generate excerpt.raw

Add this code to your WordPress theme's functions.php file (or via a plugin like Code Snippets):

function tulipemedia_rest_excerpt($response, $post, $request) {
    if ($post->post_type !== 'post') {
        return $response;
    }

    $max_chars = 800;
    $text = !empty($post->post_excerpt) ? $post->post_excerpt : get_the_content(null, false, $post);
    $text = strip_shortcodes($text);
    $text = wp_strip_all_tags($text);
    $text = trim($text);

    // Approximation : 1 mot ≈ 6 caractères
    $word_count = round($max_chars / 6); // ~133 mots
    $text = wp_trim_words($text, $word_count, '');

    // Chercher la dernière ponctuation
    $punctuations = ['.', '!', '?'];
    $last_punct_pos = -1;
    foreach ($punctuations as $p) {
        $pos = mb_strrpos($text, $p);
        if ($pos !== false && $pos > $last_punct_pos) {
            $last_punct_pos = $pos;
        }
    }
    if ($last_punct_pos !== -1) {
        $text = mb_substr($text, 0, $last_punct_pos + 1);
    } else {
        $text .= '...';
    }

    $response->data['excerpt']['raw'] = $text;
    $response->data['excerpt']['rendered'] = wpautop($text);
    return $response;
}
add_filter('rest_prepare_post', 'tulipemedia_rest_excerpt', 10, 3);

Explanation of the code

1. Generation of an extract of approximately 800 characters (~133 words)

The code starts by fetching the article's content and transforming it into an excerpt of approximately 800 characters if no manual excerpt is set. Here's how it works:

  • Content recovery:

$text = !empty($post->post_excerpt) ? $post->post_excerpt: get_the_content(null, false, $post);

If a manual excerpt (post_excerpt) is defined in the WordPress editor, it is used.Otherwise, the full content of the article is retrieved with get_the_content. As such, when you have the time, don't hesitate to customize the excerpt in WordPress; it's always good. However, if you don't have the time or the beginning of your article is naturally optimized to be a good excerpt, this is where this tutorial comes into its own, because we will automatically generate an excerpt optimized for social networks.
  • Content cleaning:

$text = strip_shortcodes($text);
$text = wp_strip_all_tags($text);
$text = trim($text);

    • strip_shortcodes removes WordPress shortcodes.
    • wp_strip_all_tags removes all HTML tags.
    • trim removes unnecessary spaces.
  • Cut to about 800 characters:

$post);$max_chars = 800;
$word_count = round($max_chars / 6); // ~133 words
$text = wp_trim_words($text, $word_count, '');

  • $max_chars = 800 sets the target length in characters.
  • The approximation round($max_chars / 6) converts this length to words, assuming that a word is about 6 characters long in French (e.g., 800 ÷ 6 ≈ 133 words).
  • wp_trim_words($text, $word_count, ») trims the text to about 133 words, without adding any suffixes (like …).

2. Generation of an extract of approximately 800 characters (~133 words)

After trimming to ~800 characters, the code adjusts the snippet to end at the last strong punctuation mark, for a natural rendering:

  • Search for last punctuation:

$punctuations = ['.', '!', '?'];
$last_punct_pos = -1;
foreach ($punctuations as $p) {
$pos = mb_strrpos($text, $p);
if ($pos !== false && $pos > $last_punct_pos) {
$last_punct_pos = $pos;
}
}

    • $punctuations defines the punctuation marks to search for (., !, ?).
    • mb_strrpos finds the position of the last occurrence of each sign in the text.
    • $last_punct_pos keeps the furthest position found.
  • Cut at this position:

$if ($last_punct_pos !== -1) {
$text = mb_substr($text, 0, $last_punct_pos + 1);
} else {
$text .= '...';
}

    • If a punctuation mark is found ($last_punct_pos !== -1), mb_substr breaks the text at that position (including the punctuation mark).
    • Otherwise, add … at the end to indicate that the excerpt is truncated.

Ultimately, this code:

  • Generates a snippet of approximately 800 characters (~133 words) from the article content, if no manual excerpt is defined.
  • Cut the excerpt at the last punctuation mark (., !, ?) for a natural rendering.
  • Exposes the raw extract in excerpt.raw (without HTML tags) and the formatted excerpt in excerpt.rendered (with tags <p> And <br />) if necessary.

How to customize this code according to your needs?

1. Change the length of the excerpt

To change the target length (for example, from 800 to 500 characters):

  • Adjust $max_chars : $max_chars = 500; // Replace 800 with the desired length in characters
  • Impact : $word_count = round($max_chars / 6) will automatically recalculate the number of words (e.g., 500 ÷ 6 ≈ 83 words), considering that the average length of a word is about 6 characters, and wp_trim_words will cut to this new length.
  • Example : If you want a shorter snippet (280 characters for example), set $max_chars = 280.

2. Change character/word approximation

The current approximation (1 word ≈ 6 characters) is adapted to French, but this may vary depending on the language or writing style. To adjust:

  • Change the divisor : $word_count = round($max_chars / 5); // If a word has an average of 5 characters
  • Example : for 800 characters, this would give 800 ÷ 5 ≈ 160 words.

3. Change punctuation marks

To add or remove punctuation marks to search for (for example, add … or 😉:

  • Adjust $punctuations : $punctuations = ['.', '!', '?', '…', ';'];
  • Impact : The code will also look for … and ; to cut the snippet, which can be useful if the content uses these signs frequently.

4. Change the truncation suffix

If no punctuation is found, the code adds …. To use another suffix (e.g., [Read more]), modify this line:

  • Adjust the suffix : $text .= '[Read more]'; // Replace '...' with the desired suffix
  • Example : This can be useful to encourage readers to click on a link to the full article. Be aware that Google Business already has its own call-to-action button.

Custom Code Example

Here is the modified code with a length of 500 characters, a 5 character divider per word, additional punctuation, and a custom suffix:

function tulipemedia_rest_excerpt($response, $post, $request) {
if ($post->post_type !== 'post') {
return $response;
}

$max_chars = 500; // Longueur cible : 500 caractères
$text = !empty($post->post_excerpt) ? $post->post_excerpt : get_the_content(null, false, $post);
$text = strip_shortcodes($text);
$text = wp_strip_all_tags($text);
$text = trim($text);

// Approximation : 1 mot ≈ 5 caractères
$word_count = round($max_chars / 5); // ~100 mots
$text = wp_trim_words($text, $word_count, '');

// Chercher la dernière ponctuation
$punctuations = ['.', '!', '?', '…', ';'];
$last_punct_pos = -1;
foreach ($punctuations as $p) {
$pos = mb_strrpos($text, $p);
if ($pos !== false && $pos > $last_punct_pos) {
$last_punct_pos = $pos;
}
}
if ($last_punct_pos !== -1) {
$text = mb_substr($text, 0, $last_punct_pos + 1);
} else {
$text .= '[Lire la suite]';
}

$response->data['excerpt']['raw'] = $text;
$response->data['excerpt']['rendered'] = wpautop($text);
return $response;
}
add_filter('rest_prepare_post', 'tulipemedia_rest_excerpt', 10, 3);

Test this by accessing your blog's REST API, for example: mysite.com/wp-json/wp/v2/posts/ID and replacing ID with the ID of a test post. Look for the excerpt.raw field in the JSON response to confirm it is present and at the desired length.

Step 2: Create a Zapier account and configure the Zap

Sign up on Zapier and create a free account. The free version allows up to 100 tasks per month, which is enough for a few monthly publications.

Create a new Zap: Click “Create Zap” in the Zapier dashboard.

Trigger: New WordPress post

Choose the “WordPress” app as the trigger, then select the “New Post” event: this will trigger the Zap each time a new article is published.

Zapier will ask you for your site URL and your WordPress credentials (username and password, or an authentication method via a plugin if necessary). If you're using a security plugin, you may need to enable the REST API or create a specific user for Zapier.

Test the trigger: Publish a test article or select an existing article (like article ID 9941 if you have one). Zapier should retrieve the article data, including Excerpt Raw.

Action 1: Post on Instagram

Add an action: Click the “+” to add a step.

Choose the "Instagram for Business" app and the "Publish Photo" action. You must have an Instagram Business account connected to a Facebook page. Connect your Instagram Business account by following the instructions to connect your account via Facebook. You will need to authorize Zapier to access your Instagram Business page.

WordPress to Instagram via Zapier

Configure the action:

  • Photo: Select the URL of your item's image (Featured Media URL in WordPress data).
  • Caption: Use the field Raw excerpt for the caption. You can also add the title of the article and a link to it (e.g., Title + Excerpt Raw + Link).

Here is the legend I personally chose to give an idea:

{{excerpt__raw}}

FIND THE FULL POST ON THE LIBSHOP BLOG 👉 {{link}}
#libshop #restaurant #paris

Next, test the action by sending a test post to Instagram. Make sure the post appears on your Instagram Business profile with the correct caption and image.

Action 2: Publish on Google Business Profile

Add another action: Click the "+" to add a new step. Choose the "Google Business Profile" app and the "Create Post" action. Connect your Google account, select the business profile you want to use, and configure the action:

  • Summary: Use Excerpt Raw for post content.
  • Action Button Url: {{link}}
  • Photo Source URL: Featured Media URL.

Test the action by submitting a test post to Google Business Profile. Verify that the post appears on your business profile.

WordPress to Google Business Profile via Zapier

Action 3: Publish on other platforms (optional)

You can add other platforms supported by Zapier (still within the free limit of 100 tasks per month). For example, you can add LinkedIn to the automation to share your article on your profile or a LinkedIn page. Configure the message with Excerpt Raw and Link, as well as Featured Media URL.

Step 3: Test and activate your Zap

  • Test all actions: Make sure each platform (Instagram, Google Business Profile, and others) is receiving posts correctly.
  • Turn on the Zap: Once everything is working, turn on the Zap by clicking “Turn on Zap”.
  • Monitor your Zapier tasks: With the free version, you're limited to 100 tasks per month. Each post on a platform counts as one task (e.g., 1 Instagram post + Google Business Profile = 2 tasks). If you publish 5 posts per month across 3 platforms, that's 15 tasks, which is well within the free limit.

Conclusion

With Zapier, automate sharing your WordPress articles to Instagram, Google Business Profile, and other platforms is a breeze, even with a free account. By using excerpt.raw, you ensure your excerpts are clean and ready to publish without any additional cleaning. Try this method on your blog and save time to focus on creating quality content for your audience and customers!

Do you have any other tips for automating your digital marketing with WordPress? Share them in the comments!

Don't miss business advice by email

No spam, just an email when new content is published.

Leave a Reply

Your email address will not be published. Required fields are marked *

Don't miss business advice by email

No spam, just an email when new content is published.

en_US