Custom Fields
Support General How to get value of Custom Fields in Block Render Settings without HTML formatti

  • Creator
  • #31820

    custom field for Taxanomy Advanced ( ) returns the value already wrapped in HTML list.

    {{ my_tags }} outputs:
    <li><a href="..." title="...">...</a></li>
    <li><a href="..." title="...">...</a></li>

    The same applies for IF statement {% if my_tags == ...
    No luck using loops either.

    It can be stripped out of HTML tags, yet for the Post field ( ), it becomes near to impossible to extract information about selected posts in a way it can be further used in a template. I need to be able to iterate through the selected posts, access their properties and output them the way I need them to be structured.

    I have also noticed that RADIO button always returns the value, not the key. There seem to be some filter for outputing variables of any kind. It's nice and easy for sure, yet not suited for more complex tasks.

    Is there any way to get unformatted output?
    Thank you.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Author
  • #31828

    I also know about the rwmb_get_value function, but none of rwmb_* functions returns anything for me.

    That works:

    {{ my_field }}
    That not works: (returns nothing at all)
    {{ mb.rwmb_get_value('my_field') }}
    {{ mb.rwmb_get_value('my_field', '', post_id) }}

    I'm still inside Block Render Settings of Custom Fields, if that means anything.

    Long Nguyen


    You can try to use the helper function mb_get_block_field() to get the field value (raw) in the block. Get more details on this documentation


    Works like a charm. Couldn't find it.
    Thank you!

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