0

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.com/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?

9
  • 1
    The contents of MORE CODE HERE seems important here. Can you include the actual code that’s causing the problem? 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. 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. 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

1 Answer 1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.