Skip to content

Instantly share code, notes, and snippets.

@mtias
Last active July 10, 2017 09:32
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
<?php
$parser = new Gutenberg_PEG_Parser;
$blocks = $parser->parse( get_post( $post_id )->post_content );
// ordered array of blocks in the post
// each block has the following keys
//
// 0 => string 'blockName'
// 1 => string 'attrs'
// 2 => string 'rawContent'
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment