Gutenberg – Title field required

You could use PluginPrePublishPanel to check for the title and lock publishing if it’s empty. Have a look at the accepted answer here for an example of locking the post – Add pre-publish conditions to the block editor For your example you could modify the checking portion as follows: const { registerPlugin } = wp.plugins; … Read more

How change a core block label

That is the block title and you can use the blocks.registerBlockType filter in the block editor to change the block title and other settings as well. So for example, this would change the title to “My Heading”: function changeHeadingBlockTitle( settings, name ) { if ( name !== ‘core/heading’ ) { return settings; } return lodash.assign( … Read more

Custom post type editor uses old tinyMCE

In your code where you defined your custom post type (in a custom plugin or in your functions.phpfile), you need to add this snippet for Gutenberg block editor support: ‘show_in_rest’ => true, ‘supports’ => array(‘editor’) Here is an example: function portfolio_post_type() { register_post_type( ‘portfolio’, array( ‘labels’ => array( ‘name’ => __( ‘Portfolio’ ), ‘singular_name’ => … Read more

Additional classes `undefined` after saving post in Gutenberg

After about an hour of trial and error, I found that the outmost <Fragment> was the culprit. But I still can’t figure out why! Replacing it with <div> fixed it. So the code looks like this now: edit: (props) => { const {attributes, setAttributes} = props; const headingBgOverlay = Util.getBgOverlay(attributes, ‘heading’); const bodyBgOverlay = Util.getBgOverlay(attributes, … Read more