Add To Gutenberg Sidebar

If you’re looking to work with the Gutenberg sidebar, WordPress has a provided tutorial that will teach you exactly how to do this: https://wordpress.org/gutenberg/handbook/designers-developers/developers/tutorials/plugin-sidebar-0/

How to remove the core embed blocks in WordPress 5.6?

With WordPress 5.6 (Gutenberg v8.8.0), the implementation of the core-embed/* blocks changed (see pull request #24090: Refactor embed block to single block with block variations). There are now 43 blocks with block variations of the core/embed block. Available core blocks are: core/paragraph core/image core/heading core/gallery core/list core/quote core/shortcode core/archives core/audio core/button core/buttons core/calendar core/categories core/code … Read more

WordPress adding scaled images that don’t exist (1536×1536 and 2048×2048)

I found the culprit! WordPress 5.3 introduced additional image sizes which can be found via /wp-includes/media.php. Updating my function, like so, removed the extra sizes: function remove_default_image_sizes( $sizes) { unset( $sizes[‘large’]); // Added to remove 1024 unset( $sizes[‘thumbnail’]); unset( $sizes[‘medium’]); unset( $sizes[‘medium_large’]); unset( $sizes[‘1536×1536’]); unset( $sizes[‘2048×2048’]); return $sizes; } add_filter(‘intermediate_image_sizes_advanced’, ‘remove_default_image_sizes’);

Gutenberg editor add a custom category as wrapper for custom blocks

Digging myself deeper in documentation, I got the following result. There is a way to group your custom blocks around a given category in Gutenberg, and therefore we have the method block_categories_all. So with a filter, you can extend the default categories with custom ones. Here is my example: add_filter( ‘block_categories_all’, function( $categories, $post ) … Read more

Removing panels (meta boxes) in the Block Editor

The remove_meta_box() function will not work with the Block Editor, because these are now Panels and work differently. There is currently no documentation on how to disable Panels, but, let’s dance. We want to avoid hiding panels via CSS, and rely on the JS API. We need to use the JS function removeEditorPanel() which will … Read more

Set default image link target in Gutenberg image block

This was (finally) fixed to Gutenberg (and will be applicable for both the image and the gallery blocks); and will add an option to WordPress options’ database table. this was done in https://github.com/WordPress/gutenberg/pull/25578 and https://github.com/WordPress/gutenberg/pull/25582 It’ll be added to WordPress 5.6 but it’s already available in the Gutenberg plugin. To link the image to the … Read more