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!

Remy van Duijkeren

Remy van Duijkeren

Power Platform Advisor

Microsoft Power Platform Advisor with over 25 years of experience in IT with a focus on (marketing) automation and integration.

Helping organizations with scaling their business by automating processes on the Power Platform (Dynamics 365).

Expert in Power Platform, Dynamics 365 (Marketing & Sales) and Azure Integration Services. Giving advice and strategy consultancy.

Services:
– Strategy and tactics advise
– Automating and integrating

Subscribe to
The Daily Friction

A daily newsletter on automation and eliminating friction

Related Content

External authentication with Dataverse ServiceClient

For a while now we can use the new Dataverse ServiceClient that replaced the old CrmServiceClient. It has three big improvements: Works for .NET 5.0 and up (.NET Core) Uses the newer MSAL.NET instead of ADAL.NET (which is out of support) for authentication Support for...

read more

Everyone got ALM wrong in Dynamics 365 / Dataverse

For ages, we've been ferociously encouraging the integration of developer practices, such as source control and ALM, into the Dynamics 365/Dataverse realm. The ultimate truth The revered 'Master Branch' in source control, has always been the sole fountainhead from...

read more
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