wp-kit / gutenberg-object-plugin
Saving Gutenberg as a clean array of data to the database
2.0.6
2020-07-26 08:42 UTC
Requires
- php: ^7.4
- composer/installers: ^1.5
This package is not auto-updated.
Last update: 2024-12-11 11:36:59 UTC
README
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'
toresources/config/constants.config.php
- Add
GutesObjectPlugin\Provider::class
toresources/config/providers.config.php
Installation (Wordpress)
- Download Zip and upload to Wordpress plugin directory
- Add
define('GUTENBERG_OBJECT_PLUGIN_CPTS', 'page');
tofunctions.php
- Add
(new GutesObjectPlugin\Provider)->register();
tofunctions.php
Database
Data will be saved in a new database table [prefix]_gutes_arrays
JSON
Block data gets appended editor_blocks
on the normal page/post responses.
Endpoints
Includes 1 new route:
wp-json/gutes-db/v1/[post-id]
- Supports GET & POSTwp-json/gutes-db/v1/[post-id]/revisions
- Supports GET only
GET
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