Headless WordPress

Hi,

Is there a way we should be able to use Wordpress as headless CMS? :slight_smile:

WP themes are good, but wordpress is still WP, it’s really good for content management but website consistancy is not always here.

Thanks
Philippe

Hi Philippe

There actually is. Since a couple of releases ago, the WP REST API was introduced. This allows you to create a HTML frontend (for example in Blocs) and by adding some logic to it, you could load the content via the REST API, hence using WordPress solely as the content storage, but not to generate the frontend.

More info on the REST API can be found here:

3 Likes

Hi brechtryckaert,

To be sure of my understanding, I know that there is a WP Theme support.
Also tested the Blocs Developper plugin to load dummy content from a wordpress.

But how should I do to use Blocs with a headless WP in production ? Can’t find any clear guidance on that :slight_smile:

Thanks
Philippe

There’s no real easy way for this so far.

In essence you’d use Blocs to create a HTML template (be mindful not to export or create a WordPress theme). This HTML template would then need to be edited to retrieve the content from the WordPress backend using the REST API.

This article will give you a decent introduction to implementing the REST API (with example code):

Thanks :slight_smile:

So maybe it could be usefull to be able to directly embed the REST api in Blocs someday.

Philippe