How to remove specific panels in the editor (Gutenberg) when editing a block (via right panel)?

Removing specific panels or features for a block is done on a per block basis using various hooks (https://github.com/WordPress/gutenberg/issues/15450#issuecomment-635255936) Update (August 2021) Removing specific panels (that would allow for customization of a block) can now be done through the theme.json aka global settings and styles which allows you to customize settings (colors, typography, etc) for … Read more

Best practices for CPT without using an editor [closed]

I have used the custom block option quite extensively. I enable the editor for the custom post type, but use a custom template with template_lock set to true: ‘template’ => array( array(‘pb/custom-block-name’), ), ‘template_lock’ => true Then I use the allowed_block_types_all filter to only allow that custom block for the post type: function pb_allowed_block_types($allowed_block_types, $block_editor_context) … Read more

Gutenberg translation is not working

I’ve spent all day debugging this issue, and by looking at the code I can guess we shared the same problems: assuming $script_handle is CUSTOM-block-ref-holder, the PHP file is almost correct. wp_set_script_translations needs the full path to work. In your case, although you probably need to adjust for your path, it should be something like … Read more

Reset data when the field is cleared

That’s not how that component works. onRemove is called when the link is unlinked, via a button that only appears when certain conditions are met: { onRemove && value && ! isEditingLink && ! isCreatingPage && ( <Button className=”block-editor-link-control__unlink” isDestructive variant=”link” onClick={ onRemove } > { __( ‘Unlink’ ) } </Button> ) } https://github.com/WordPress/gutenberg/blob/6eac4a26f143c7378c3b39b5a83271538f36dfa9/packages/block-editor/src/components/link-control/index.js#L270 When … Read more