Questions tagged [gutenberg-blocks]
515 questions
6
votes
1 answer
Wordpress Add onclick event inside Gutenberg block
I have been searching everywhere to figure out how to add an event inside a gutenberg block. I am working to add an accordion system using ACF and Foundation. I have created a block and fields and template using ACF. I would like my users to be…

James
- 702
- 2
- 15
- 39
5
votes
2 answers
Gutenberg Blocks: registering more than one block with `register_block_type_from_metadata()` throws errors in the console
I'm practicing how to create Gutenberg blocks plugin. I use @wordpress/create-block to create a blocks plugin.
Edit: I didn't use the wp-cli scaffold as I initially stated, what I meant to write is that I used @wordpress/create-block.
The scaffold…

Laloptk
- 201
- 2
- 8
5
votes
1 answer
Is there a way to add new tab in WordPress Gutenberg editor
I am completely new to Gutenberg and I need to add a new tab in the setting section Please check this screenshot
I Have created some blocks for Gutenberg but no experience in this. I tried this code
import { TabPanel } from…

Manoj Dhiman
- 5,096
- 6
- 29
- 68
5
votes
1 answer
Filtering SelectControl items according the input from another SelectControl in Gutenberg Block (ES5, no JSX)
I have 2 SelectControl from a Wordpress Gutenberg Custom Block I'm trying to build. I don't use ES6. Only ES5 and no JSX.
The 2 SelectControl should work in the following way:
They fetch from REST WP Api the Post Types and all the Posts. What I…

Claudio Ferraro
- 4,551
- 6
- 43
- 78
5
votes
2 answers
Wordpress: Is it possible to use post-type as part of a css selector in block editor stylesheet?
I created a Wordpress theme and now I am working on an editor-stylesheet for the block editor to better reflect the look of the theme in the editor. For this, I need to be able to address different post types in there.
For the frontend, there is the…

Johannes
- 64,305
- 18
- 73
- 130
5
votes
2 answers
Get Gutenberg Blocks without the_content()
I'm trying to display the gutenberg blocks from a specific post ID inside another one.
The question is, does exist a function that I can get all blocks from one post and display it anywhere in the site? Just like get_the_content do?

Ledilson Motta
- 53
- 1
- 5
5
votes
0 answers
How to fix 'Error loading block: Invalid parameter(s): attributes' error in WordPress
I am attempting to extend an existing block which is registered in the Tasty Recipes plugin. I've added a control to the sidebar to handle selection of a given diet type, however when an option is selected, the following error is displayed:
Error…

Connor Hansen
- 63
- 1
- 8
5
votes
1 answer
Gutenberg core blocks - remove options
Using core WP Gutenberg blocks is fantastic, but in certain cases I would like to refine the available options to improve my clients user experience, and avoid them having too many options.
For example, in the Heading block, I would like to remove…

dungey_140
- 2,602
- 7
- 34
- 68
5
votes
0 answers
Run script right after adding a specific Gutenberg block
How to run a script right after adding a block? I'm adding map block using ServerSideRender but it only prints div with map id map-canvas. I want to apply
var map = new google.maps.Map(document.getElementById('map-canvas')
How I would apply it…

Rameez Iqbal
- 507
- 1
- 5
- 24
5
votes
1 answer
Wordpress Gutenberg withSelect get list of post types
I am using Gutenberg's withSelect package to try to get all of the post types belonging to the site. Here is my code:
export default withSelect( select => {
// shorthand
const { getEntityRecords } = select( 'core' );
return {
…

rhysclay
- 1,645
- 3
- 22
- 42
4
votes
1 answer
Injecting JavaScript variables to custom Wordpress block editor
I am creating a few custom blocks in a theme, and I have a problem. Sometimes I have a need to pass some custom data to my blocks in the blocks editor.
In other words, I need data to be available in the blocks/myBlock/index.js (the editor script).
I…

lejahmie
- 17,938
- 16
- 54
- 77
4
votes
0 answers
Can't render multiple innerblocks with ACF Blocks. How do I make them unique?
I'm using ACF to create two blocks, Tabs and Tab. Tabs is the container with innerblock that only allowes Tab block. Tab block has the innerblock that any block. As I've read from multiple forums this is how it's suppose to be done to allow multiple…

user15396919
- 65
- 4
4
votes
4 answers
Remove inline styling from gutenberg block gallery
I have updated my wordpress and it now displays the following CSS on my page: