customization - Adding more than one Wordpress Gutenburg block type?

admin2025-06-02  3

I am currently in the process of creating a Wordpress plugin that allows extra block types to be added for creating posts. I have successfully created a wordpress block type but it doesn't work when I add two.

The following code is in a JS file.

When I add two block types, Wordpress's backend editor doesn't even recognise the first block. Removing the second block makes the first block type register and work. To those who are experienced in Wordpress plugin creation, what error am I making?

I am currently in the process of creating a Wordpress plugin that allows extra block types to be added for creating posts. I have successfully created a wordpress block type but it doesn't work when I add two.

The following code is in a JS file.

https://pastebin/5GMp3aa1

When I add two block types, Wordpress's backend editor doesn't even recognise the first block. Removing the second block makes the first block type register and work. To those who are experienced in Wordpress plugin creation, what error am I making?

Share Improve this question edited Feb 26, 2019 at 15:18 Jack Wright asked Feb 26, 2019 at 15:03 Jack WrightJack Wright 11 bronze badge 9
  • 1 The contents of MORE CODE HERE seems important here. Can you include the actual code that’s causing the problem? – Jacob Peattie Commented Feb 26, 2019 at 15:06
  • I didn't think it was important as the code within the block is functioning and working. But, I will copy and paste all of it now. – Jack Wright Commented Feb 26, 2019 at 15:11
  • Are there any errors in the browser console? – Tom J Nowell Commented Feb 26, 2019 at 15:16
  • Absolutely none, I was surprised! Tell a lie, there was a few but they had nothing to do with the script itself. – Jack Wright Commented Feb 26, 2019 at 15:18
  • What happens if you try to whittle the code down to the smallest reproducible example? Also are you using webpack/babel? Or are you writing all your React components from scratch? And by doesn't recognize, do you mean it's as if you never made the first call? Or something else? I also noticed you namespaced your blocks, I have never seen that before – Tom J Nowell Commented Feb 26, 2019 at 15:27
 |  Show 4 more comments

1 Answer 1

Reset to default 0

To create a new block make the second block contain actual working code! I was silly and there was some syntax errors in the second method.

转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1748863115a314346.html

最新回复(0)