WordPress Blocks Post using the REST API

by Jun 16, 2023

Sending email to my subscribers is done by an automation flow.

In the last couple of days paragraphs in my emails started to disappear. It changed into one large blob of text which is very annoying to read. Sorry about this!

The automation depends on the RSS-feed of WordPress, where I keep an archive of my emails. After a change of the RSS-feed, it was only returning one big blob of text, no paragraphs.

Classic Block

My RSS-feed broke when a post was using the Classic Block from the Classic Editor. When converted to the blocks in the Block Editor it worked again.

Most of my posts, I create through the WordPress REST API. This uses the Classic Block for my post. I want to use the new blocks using the WordPress REST API.

There is a function in WordPress to convert the Classic Block Post to the new Blocks. You can use this function when posts are being made through the WordPress REST API, but that involved coding. I didn’t want to follow that route. My PHP skills are not up to date anymore.

Could I change what I’m posting to the WordPress REST API?

Yes, you can! By surrounding paragraph with the special WordPress <!– wp:paragraph –>, I could post it as Blocks! By transforming paragraphs like below, I could solve it.

 <p>Every Productivity book: How to finish tasks quickly!</p>

// transform to

<!-- wp:paragraph --> <p>Every Productivity book: How to finish tasks quickly!</p> <!-- /wp:paragraph -->

Zapier

I use an automation in Zapier to create a post in WordPress. I now have extended this automation by adding the Text Formatter to add this special tag to each paragraph.

The flow now looks like this:

This should save the problem for the future!

Subscribe to
The Daily Friction

A daily newsletter on automation and eliminating friction

Related Content

Early-Bound Classes for .NET 4.6.2 and 6.0

Early-Bound Classes for .NET 4.6.2 and 6.0

You like to use strong types in .NET when working with Dataverse / Dynamics 365? Are you into Early-Bound Classes? Generating entity classes? You can use CrmSvcUtil for this, but I personally like to use XrmContext from Delegate to do this, because it creates smaller...

read more
Form Data OnLoad

Form Data OnLoad

You want to call Form OnLoad multiple times? Don't! I was reading about a blogpost to trigger the Form OnLoad multiple times. This should happen after the data was saved and/or refreshed. Why would you want this? Usually, the Form OnLoad contains logic to change the...

read more
Who is the target audience for Power Pages

Who is the target audience for Power Pages

Power Pages is slowly getting better and better product. But then I look at the pricing page: https://powerpages.microsoft.com/en-us/pricing/ Who is the target audience for this product? If you need something 'quick and dirty' it is nice to have a website up and...

read more
Share This