• Skip to primary navigation
  • Skip to main content
Sal Ferrarello
  • About Sal Ferrarello
  • Speaking
  • Connect
    Mastodon GitHub Twitter (inactive)
You are here: Home / Draft / How the WordPress Block Based Editor Stores Blocks

How the WordPress Block Based Editor Stores Blocks

Last updated on June 18, 2018 by Sal Ferrarello

All of the following examples are part of the content stored in the post_content column of the database.

A Static Block

A Paragraph Block

<!-- wp:paragraph -->
<p>This is a paragraph block.</p>
<!-- /wp:paragraph -->

A Quote Block

<!-- wp:quote -->
<blockquote class="wp-block-quote">
  <p>I was only ever wrong once
  and that was the time I
  thought I was wrong.</p>
  <cite>My Grandfather</cite></blockquote>
<!-- /wp:quote -->

A Dynamic Block

<!-- wp:my-plugin/my-block -->
<p class="wp-block-my-plugin-my-block">
  Hello from the saved content!</p>
<!-- /wp:my-plugin/my-block -->

A Dynamic Block

Dynamic block – no stored attributes

The following block would either have no attributes (or the attributes are stored in post meta).

<!-- wp:my-plugin/my-block /-->

Dynamic block with attribute called “val”

<!-- wp:my-plugin/my-block {"val":"Now I have editable content. I editted this."} /-->
Sal Ferrarello
Sal Ferrarello (@salcode)
Sal is a PHP developer with a focus on the WordPress platform. He is a conference speaker with a background including Piano Player, Radio DJ, Magician/Juggler, Beach Photographer, and High School Math Teacher. Sal can be found professionally at WebDevStudios, where he works as a senior backend engineer.

Share this post:

Share on TwitterShare on FacebookShare on LinkedInShare on EmailShare on Reddit
Warning! This is a draft, not a finalized post. See full draft disclosure.

Filed Under: Dev Tips, Draft, Programming Tagged With: Gutenberg, WordPress

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Copyright © 2023 · Bootstrap4 Genesis on Genesis Framework · WordPress · Log in