Category: Code

  • Using block editor SlotFills to render a meta box

    Whether you were an early adopter of Gutenberg as a plugin or have used it as the block editor as of WordPress 5.0, you may have noticed that meta boxes added with the add_meta_box() function look and feel a little different than the rest of the panels in the Page sidebar. Compared to the default

    Read more

  • Using a primary category in WP permalinks

    Many SEO experts recommend using your category in your post permalinks, as it gives another hint of context to both search engines and human visitors. But what happens when you assign more than one category per post? Option 1: Core behavior Let’s say you start out with a /%category%/%postname%/ structure already in place. You publish

    Read more

  • Using block.json to register a custom Gutenberg block

    The Block Editor is beginning to mature, as core contributors find creative ways to simplify block creation and improve performance. In WordPress 5.8, a new file called block.json was introduced to solve the frustration of having to register blocks in two different languages. Before 5.8, if you wanted to create a dynamic block with attributes,

    Read more

  • Changing the attribute set for dynamic Gutenberg blocks

    The Block Editor Handbook has excellent documentation for updating static block markup and attributes, but not as much when it comes to updating dynamic blocks. This isn’t surprising, as it’s generally much easier to make updates to dynamic blocks. But what if you need to make non-trivial changes to a dynamic block’s attribute set? Say,

    Read more