What are dynamic and regular blocks? Which one is better?
At first glance, Dynamic blocks sound more fancy and powerful. But this is not always the case.
Note, Pinegrow can also create Hybrid blocks, that combine benefits of Regular and Dynamic blocks into one. Learn more.
Dynamic blocks, on the other hand, are rendered by PHP code on the server. Every time we change a property of such block in the block editor, the editor passes the attributes to the WordPress site, where the block PHP code outputs the block content and sends it back to the browser where it is displayed. This creates a noticeable delay when editing the block.
The content of dynamic blocks is also not directly editable. All changes need to happen through controls in the editor sidebar.
So, why do we need dynamic blocks then?
Dynamic blocks can display up-to-date content from the WordPress database, for example the list of the last five posts. Dynamic blocks are rendered with PHP code on the server. That means we can use all server-side WordPress functions such as running queries, getting meta fields, user information and more. In Pinegrow, we can use all WordPress actions in dynamic blocks.
With regular blocks, the only actions we can use are Block attributes and Block inner content. If we add any other WordPress action to the block, Pinegrow will export it as a dynamic block, even if its block type is set to Regular.
Another important difference is that dynamic blocks are rendered each time they are displayed. This means that the information they display (for example, the list of the last five posts) will always be up to date, no matter how long ago the block was added to the page or post.
How to decide what block type to use?
Do you need to display any up-to-date information from the WordPress database? If yes, use a dynamic block.
Do you need to use any non-block WordPress action to display the block (for example, the name of the current user)? If yes, use a dynamic block.
In all other cases, create a regular block.
The best approach is to select the Regular block type in Pinegrow. If you then add any non-Block WordPress action to the block, Pinegrow will automatically export the dynamic block.
Pinegrow also supports creation of ACF PRO blocks. In addition to Block actions, you can also use Post field action with “Use ACF” checked to create editable fields.