Just Disable Autosave in the Block Editor

In our custom workflow plugin, every revision matters, so I needed to disable the autosave feature in WordPress. You used to be able to just edit a line or two wp-config.php to effectively disable autosave: define(‘AUTOSAVE_INTERVAL’, 86400); This technically set the autosave interval to one day (86,400 seconds). But since the release of the Block …

CPT loads as a white screen in WordPress block editor

When you’re finally ready to try a new editor, it’s frustrating to run into problems like this. Luckily, there’s a quick fix. Fix: enable show_in_rest for your CPT Your CPT must be available in the REST API, or it won’t work in the Block Editor. If you’ve created your CPT in code, you can simply …

Custom Related Posts block for WordPress 5.3

This block is very much based on my original Related Posts block. However, it contains a major bug fix – in the original block, you always had to change the post type even if you then changed it back to the default type, or it wouldn’t save any data – and it’s also been updated …

Building a Related Posts block for WordPress

Please note: this tutorial is now out of date. I’ve updated the block and the whole tutorial here: Custom Related Posts block for WordPress 5.3 The St. Mary’s website contains a lot of content. Most of it is segmented into custom post types, with various taxonomies and relationships that connect things wherever possible. But sometimes, …

Add and remove style variations in the Block Editor

Some of the blocks included in WP Core include style variations. They’re a nice way to have a single component that can be styled in several different ways. One example: the Button block. As of August 2019, in version 5.2.2, Core includes 3 style variations with the Button: Default, Outline, and Squared. You can see …

Replacing create-guten-block with a custom Webpack

If you’re reading this, I expect you’ve either read my table block tutorial or built your own blocks with create-guten-block. If you haven’t dealt with JavaScript that has to be compiled – or transpiled – you may want to go through a create-guten-block tutorial as it makes things easier to set up in the beginning. …

Gutenberg – building a more accessible table block

This is a long, single-post tutorial, so here is a table of contents to help you keep your place: Overview I’m writing this in June 2019. We’re a couple of releases past the big 5.0 block editor release. The table block that ships in WP Core is noticeably lacking in basic functionality. When you add …

Gutenberg – change block output using PHP or JS

If you’re a PHP developer like me, the Block Editor is like a whole new frontier for coding. It’s hard to get your bearings to know where to begin. Thankfully, now that Gutenberg is a part of WP Core, some of the documentation is improving enough that you don’t have to wade through the code …

Gutenberg – changing font size options

You can either give your users a custom set of font sizes to choose from, or completely block them from changing the font size if you’d like to allow your theme to control the font sizes. Here’s how: Remove all font size options You can remove the text box where users can enter custom font …