Meta Box
Support › MB Blocks › Show custom fields without updating
Hello, I have created a block where I use other custom fields, which get not updated in that block. This custom fields gets rendered on the homepage, but not in the editor.
{% set review_summary = mb.rwmb_meta( 'review_button_text', '', post.ID ) %} {{ review_button_text }}
How can I show the variable "review_button_text" also in the editor?
thanks Jochen
Hi Jochen,
Please use the helper function mb_get_block_field() to display the field value in the Block editor.
mb_get_block_field()
{% set review_summary = mb.mb_get_block_field( 'review_button_text' ) %}
Read more on the documentation https://docs.metabox.io/extensions/mb-blocks/#render_callback
My site is crashing, if I use the function mb_get_block_field(). I am in the field "Render code":
mb_get_block_field() was not working. But I had to replace post.ID with post_id
Hi,
In the Render Code area, you can use the field ID only to display the field value or use the helper function without passing two parameters.
{% set review_summary = mb.mb_get_block_field( 'review_button_text' ) %} {{ review_summary }}
or just {{ review_button_text }}
{{ review_button_text }}