Conditional save return on Gutenberg Block

You should define your btntype attribute as type boolean and set its default to false (maybe better rename it to download then ;). And change it to true when the user selects the download option. If you want to conditionally add the download attribute in your save functions’ JSX use this syntax: <a href={ btnurl … Read more

Get a term object using getEntityRecords

So getEntityRecords( ‘taxonomy’, ‘genre’ ) will make a request to the “list terms” endpoint at /wp/v2/genre (or /wp/v2/<rest_base> if your taxonomy uses a custom rest_base) in the REST API, and because the “list terms” endpoint for custom taxonomies by default use the same parameters used by /wp/v2/categories (the “list terms” endpoint for the built-in category … Read more

UnitControl – Block has encountered an error

The problem in your code is that UnitControl is not actually defined anywhere: If you look at the example in the documentation, the UnitControl is defined as follows: import { __experimentalUnitControl as UnitControl } from ‘@wordpress/components’; I.e. It uses the __experimentalUnitControl component in wp.components and not wp.blockEditor, and secondly, it imports the component as UnitControl. … Read more

How to hide/remove GhostKit component panel in gutenberg block inspector

Ok, nevermind, I found solution I’ve tried removeFilter( ‘editor.BlockEdit’, ‘ghostkit/sr/additional-attributes’ ); but it was not working inside my plugin, but it worked in console, so then I found out, that I need to hook this to something, so this is working solution addAction( ‘plugins.pluginRegistered’, ‘kubiq/remove-ghostkit-animations’, function( settings, name ){ if( name == ‘ghostkit’ ){ removeFilter( … Read more

Add multiple images to a custom block

There are other changes you need to make in your code, but as for the main one — making the mediaID and mediaURL be repeatable, the (core) gallery block did it by setting query as the attribute source and array as the attribute type. So I would do the same and for example you can … Read more

Gutenberg richtext block vaildation failed

The problem in your block is due to the selector value of your emailPlaceholder attribute — you set the value to span.kathyContactFormEmail, but there’s actually no span element with that class in your save() function (or the markup/HTML of the element returned by the function). What you have though, is an input with kathyContactFormEmail as … Read more