Saving Gutenberg as a clean array of data to the database

2.0.6 2020-07-26 08:42 UTC

This package is not auto-updated.

Last update: 2024-05-15 08:41:44 UTC


The purpose of this plugin is to save Gutenberg (New WordPress Editor) data as an array in the database which is accessible via the REST API.

Forked from royboy789, this plugin is intended for to be used with Rest-Kit. This plugin adds in some ACF support too with a predictable and useful JSON output. It's similar to acf-to-rest-api plugin but applies to Blocks.

Installation (With Rest-Kit)

  • Run composer require wp-kit/gutenberg-object-plugin
  • Add 'GUTENBERG_OBJECT_PLUGIN_CPTS' => 'page' to resources/config/constants.config.php
  • Add GutesObjectPlugin\Provider::class to resources/config/providers.config.php

Installation (Wordpress)

  • Download Zip and upload to Wordpress plugin directory
  • Add define('GUTENBERG_OBJECT_PLUGIN_CPTS', 'page'); to functions.php
  • Add (new GutesObjectPlugin\Provider)->register(); to functions.php


Data will be saved in a new database table [prefix]_gutes_arrays


Block data gets appended editor_blocks on the normal page/post responses.


Includes 1 new route:

  • wp-json/gutes-db/v1/[post-id] - Supports GET & POST
  • wp-json/gutes-db/v1/[post-id]/revisions - Supports GET only


GET: wp-json/gutes-db/v1/[post-id] Returns

  • is_gutes: Is the post created with Gutenberg
  • post_id: Post ID
  • data: Gutenberg Data
  • _embedded['post']: optional with _embed - response from WP REST API for post