Question

Is it possible to convert an existing Wordpress widget to a block, without having to write a custom block (javascript)?

Was it helpful?

Solution

The short answer here is no.

Widgets are written in PHP and blocks are written in JavaScript. Beyond that there pretty fundamental differences between the two paradigms in the sense of where they are stored, markup output approaches etc.

You could take the approach of a dynamic block where the block is rendered on the front end with PHP, but you'd still need to register a custom block in JavaScript ( as well as enqueue the files ) to be able to insert it into the Block Editor.

There may be plugins available that solve this, but I am not aware of any.

Hope this helps!

Licensed under: CC-BY-SA with attribution
Not affiliated with wordpress.stackexchange
scroll top