What's the Easiest Way to add Custom Field Data within a Gutenberg Post?

Support General What's the Easiest Way to add Custom Field Data within a Gutenberg Post?

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #49528
    TomTom
    Participant

    After some research I am a little surprised Metabox doesn't appear to have an easier way to insert custom field data into Gutenberg Post content.

    I have options page setup with company info like name, email, phone number, etc... (some of this info is in groups as there is more than 1 email address etc) and it would be really nice if I could use some syntax like {site_name} within paragraphs, headings, list items, etc.. and the data from the custom field would replace it.

    MB Views is more for a block of content so it will not work in this situation.

    I had thought of using short codes but Gutenberg doesn't let you place short codes within copy. It has to be a separate block.

    I can't be the only one wondering this. There is a post about it on the Trello roadmap which says it is currently being worked on but the roadmap doesn't appear to be updated since 2022.

    #49530
    PeterPeter
    Moderator

    Hello Tom,

    Thanks for reaching out.

    If you want to show the option value on a block, you can use the helper shortcode [rwmb_meta]. Here is the documentation for the shortcode: https://docs.metabox.io/shortcode/

    #49532
    TomTom
    Participant

    Thanks. I had tried short codes earlier but for some reason it did not work. I just tried it again and it works so great!

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