mb_get_block_field() in preview when storage = post_meta

Support MB Blocks mb_get_block_field() in preview when storage = post_meta

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #43253
    Cédric DagherirCédric Dagherir
    Participant

    Hi,

    I can not retrieve the stored data in my template when I define "post_meta" as storage options. Everything is empty.
    I can only get the block id.

    How can I do that ?

    Thanks,

    #43261
    PeterPeter
    Moderator

    Hello,

    The function mb_get_block_field() only gets the field value when the block data is saved as attributes (default). If you save the data as post meta, you can use the helper function rwmb_meta(), for example:

    WYSIWYG field: {{ mb.rwmb_meta( 'wysiwyg_field_id', '', post_id ) }}

    #43266
    Cédric DagherirCédric Dagherir
    Participant

    Thanks Peter, it's working 🙂

    Maybe you should complete the documentation with this information.

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.