When automating your WordPress posts to Twitter via Zapier, it's crucial to ensure the content looks clean and engaging. One common hiccup users face is when the WordPress excerpt in Zapier contains unwanted HTML tags like
I initially ran into this when I was trying to send my WordPress posts to LinkedIn, and was having trouble pulling in data like images and excerpts.
Thankfully, there's a straightforward solution to this:
Using the Zapier formatter to strip out the HTML.
You've set up a Zap to trigger every time a new post is published on your WordPress blog. This Zap is supposed to send a Tweet containing a brief excerpt from your post, the link to the blog post, and a featured image. However, you notice that the excerpt in the Tweet contains HTML tags, making it look unprofessional.
Strip HTML from the Excerpt:To remove any HTML from the excerpt, you can add a 'Formatter' step in your Zap. Zapier's 'Formatter' tool can strip away any HTML tags from your excerpt, leaving you with clean, plain text. Here's how to do it:
- After setting up your WordPress trigger, click on '+ Add a Step'.
- Choose 'Formatter by Zapier'.
- Set the action event to 'Text'.
- You'll then get an option to 'Transform' the text. Choose 'Strip HTML' from the dropdown.
- In the 'Input' field, select the WordPress excerpt. This will apply the transformation only to the excerpt and not the entire post.
- Test this step to ensure the HTML tags are removed from your excerpt.
And that's it. You'll now have a rendered excerpt that doesn't contain the <p> or </p> tags anymore. Hope this helped! Drop a comment if you have any questions!