This single-block plugin allows you to display custom fields, shortcode as blocks in the Block Editor. It supports custom fields for posts, terms, and users. It can be nested inside a parent block that has postId and postType context, such as Query Loop, WooCommerce Product Collection, Term Query, or used as a stand-alone block.
You can display any field whose value can be retrieved by the core API (get_post_meta, get_term_meta, get_user_meta) and is a string or can be converted to a string. To display the field value in the Block Editor, it has to be accessible via the REST API or have the field type set to dynamic.
You can also display custom fields created by the Advanced Custom Fields or Meta Box plugin explicitly. It supports all ACF field types and Meta Box field types whose values are strings or can be converted to strings. Some other ACF complex fields such as Image, Link, Page Link, True False, Checkbox, Select, Radio, Button Group, Taxonomy, User, Post Object and Relationship field types as well as Meta Box fields such as Select, Checkbox, Radio, Image, Video, Taxonomy, User, Post field types are also supported in basic formats.
This plugin also provides developer-friendly hook APIs that allow you to easily customize the output of the block, display complex data type fields, or use the block as a placeholder to display any kind of content with object_id and object_type as context parameters.
An edge case where this block is really helpful is when you need to get the correct post_id in your shortcode when you use it in a Query Loop. In that case, you can set the field type as dynamic and input your shortcode in the field name. The block will display it correctly on both the front end and the editor. Alternatively, if you only want to see the preview of your shortcode in the editor, you can also use this block as a better version of the core/shortcode.
To quickly learn how this block displays custom fields, watch the short guide (for MFB version 1.3.4) by Paul Charlton from WPTuts. The video focuses on the Advanced Custom Fields plugin, but you can use a similar approach to display fields from other frameworks like Meta Box.
The HTML output of a custom field on the front end depends on the context of the field. It uses one of these core API functions to get the field value: get_post_meta, get_term_meta, get_user_meta.
What is the HTML output of ACF fields?
All basic field types that return strings or can cast to strings are supported – The HTML output is from the get_field function.
The item_value can be either value or label, depending on the return format of the field. Multiple selected values are separated by ,. Below is the code snippet to change the separator:
To display complex field types or change the output of a field, use the hook meta_field_block_get_mb_field or the general hook meta_field_block_get_block_content.
Copy & paste snippets
When using the meta_field_block_get_block_content hook to customize block content, we recommend selecting dynamic as the field type. This way, both the front end and the editor will show the changes. If you are working with ACF Fields, we suggest using the meta_field_block_get_acf_field hook to modify the field content. Similarly, Meta Box users should use the meta_field_block_get_mb_field hook to modify the content. ACF snippets can also be used with Meta Box fields, but you must use the correct hook name and replace the get_field function with the rwmb_get_value function.
How to change the HTML output of the block?
Using the meta_field_block_get_block_content hook:
This basic snippet is very powerful. You can use it to display any fields from any posts, terms, users or setting fields. Please see the details in the below use cases.
How to wrap the block with a link to the post within the Query Loop?
Using the meta_field_block_get_block_content hook:
To display simple data type fields for posts, terms, and users, you only need the free version of MFB. MFB Pro can save you 90% of development time when working with ACF, or Meta Box complex fields. It achieves this by transforming your ACF complex field types into container blocks, which work similarly to core container blocks. This eliminates the need for creating custom blocks or writing custom code for displaying complex fields.
Below are some video tutorials that demonstrate how MFB Pro can help you display complex fields:
How to build a post template to display dynamic data without coding
How to display ACF Repeater fields as a list, grid, or carousel
How to display ACF Gallery fields as a grid, masonry, or carousel
Display a repeater or cloned group field as an core/accordion block.
Since version 1.5.3, MFB Pro allows you to bind custom fields (ACF, Meta Box, core meta fields, and core settings) directly to core blocks (Heading, Paragraph, Button, Image, Video, Embed, and the background image/video/embed of Cover block).
For more complex field types (Group, Repeater, Flexible Content), you can use MFB Pro to display the group as a container. Nested fields can then be displayed using the Sub Field Block, as before, or bound directly to core blocks.
If this plugin is useful for you, please do a quick review and rate it on WordPress.org to help us spread the word. I would very much appreciate it.
Please check out my other plugins if you’re interested:
Content Blocks Builder – Build custom layouts and blocks visually in the Block Editor without needing a code editor, using only core blocks and native Gutenberg features.
SVG Block – A block to display SVG images as blocks. Useful for images, icons, dividers, and buttons. It allows you to upload SVG images and load them into the icon library.
Icon separator – A tiny block just like the core/separator block but with the ability to add an icon.
Breadcrumb Block – A simple breadcrumb trail block that supports JSON-LD structured data and is compatible with WooCommerce.
Block Enhancements – Adds practical features to blocks like icons, box shadows, transforms, etc.
This plugin is created for developers, but end users can also use it.
Does it support inputting and saving meta value?
No, It does not. It only displays meta fields as blocks.
Does it support all types of meta fields?
Only simple types such as string, integer, or number can be used directly. Other complex types such as object, array need to be converted to HTML markup strings.
Does it support all types of ACF fields?
It supports all basic field types that return strings or cast to strings. Some complex field types like image, link, page_link, post_object, relationship, taxonomy, and user are also supported in a basic format. To display complex ACF field types such as Group, Repeater, Flexible Content, Gallery, File, etc., you will need to either purchase MFB PRO or write your own custom code using the hook API.
Does it support all types of Meta Box fields?
It supports all basic field types and some complex field types such as Image, Video, Choice fields, Taxonomy, User, Post, in basic format. For other complex field types, you can use the built-in hook to display your fields with custom markup. MFB PRO allows you displaying the Group field as a container block, Cloneable Group field as a repeater block with group, row, stack, grid, or carousel layout, Post field as a Query Loop, Image list fields as a gallery with grid or masonry layouts, or as a carousel of images.
What are the prefix and suffix for?
The value for those settings should be plain text or some allowed HTML elements. Their values will be formatted with wp_kses( $prefix, wp_kses_allowed_html( "post" ) ). They’re helpful for some use cases like displaying the name of the meta field or a value with a prefix or suffix, e.g. $100, 100px, etc.
Does it include some style for the meta field?
The block does not provide any CSS style for the meta field value. But it does provide a basic display inline style from the settings.
Does it support other meta-field frameworks?
Yes, it does, as long as those meta fields can be accessed via the get_post_meta, or get_term_meta, or get_user_meta function and the return value is a string or can be cast to a string. To display the value in the block editor, the meta field has to be accessed via the REST API.
What if the displayed markup is blank or is different from the meta value?
There is a chance that your meta value contains some HTML tags or HTML attributes that are not allowed to be displayed. To fix this, you should use the hook apply_filters( 'meta_field_block_kses_allowed_html', $allowed_html_tags ) to add your tags and attributes to the array of allowed tags. By default, the block allows all tags from the $allowedposttags value and basic attributes for iframe and SVG elements.
If you don’t want to sanitize the content at all, use this hook apply_filters( 'meta_field_block_kses_content', false, $attributes, $block, $post_id, $object_type, $content ). However, we don’t recommend doing it unless you have a good reason.
Improved – (MFB Pro) Added navigation buttons to the gallery lightbox
Improved – (MFB Pro) Added captions to gallery images
1.5.3
Release Date – 28 April 2026
Added – Support for width and height in WordPress 7.0
Added – (MFB Pro) Render oEmbed fields as core/embed blocks
Added – (MFB Pro) Render URL fields as video or embed blocks
Added – (MFB Pro) Allow direct binding of core blocks to custom fields without using the MFB block (supports Heading, Paragraph, Button, Image, Video, and Embed blocks)
Fixed – (MFB Pro) Error when displaying a gallery as a carousel
Improved – Updated setting controls for compatibility with WordPress 7.0
Security – Properly sanitized the tagName attribute; only valid tags are alllowed
1.5.2
Release Date – 02 March 2026
Added – New “Enable Strict Mode” setting. When enabled, only custom fields exposed via the REST API can be displayed on the frontend
Security – Restricted access to private user custom fields and core settings fields to Administrators only. Private custom fields for posts and terms are validated against their respective capabilities.
Improved – Updated UI settings styling to better match the WordPress 7.0 design
Improved – (MFB Pro) Added a “Fill Available Width” option to the Repeater row layout, allowing items to either stretch to fill the full width or keep their natural size
1.5.1
Release Date – 19 January 2026
Fixed – (MFB Pro) Bound blocks were not displayed in the pattern preview
Fixed – (MFB Pro) Context data was not available when using a block inside a pattern
1.5.0
Release Date – 15 January 2026
Added – Display subfields for the Terms Query block.
Added – (MFB Pro) Display taxonomy fields as a Terms Query.
Improved – Handle field context based on the loop context.
Improved – Display WYSIWYG fields in block format to prevent margin collapsing.
Improved – (MFB Pro) Display a repeater field as an accordion block.
Improved – (MFB Pro) Add a “link to term” option for taxonomy’s image fields.
Improved – (MFB Pro) Use native block binding when rendering “video” fields as core/video blocks.
Improved – (MFB Pro) Add display settings to the MFB Query Loop variation.
Improved – Moved Freemius into the vendor directory.
Refactored – Improved the code to support more providers.
1.4.6
Release Date – 18 November 2025
Improved – Removed _source names from the suggested list for Secure Custom Field (SCF)
Improved – Passed block settings to the meta_field_block_get_acf_field and meta_field_block_get_mb_field hooks.
Added – (MFB Pro) Support for displaying ACF Google Map fields.
Improved – (MFB Pro) Support for displaying taxonomy fields as a list of term names.
Improved – (MFB Pro) Improved handling of carousel scripts when hosts or cache plugins defer or delay the script.
1.4.5
Release Date – 10 September 2025
Improved – Refactored the code to support additional add-ons.
Fixed – Double formatting issue on ACF textarea fields.
1.4.4
Release Date – 24 June 2025
Fixed – (MFB Pro) Bound ACF True/False field to the “open by default” attribute of the details block.
Fixed – (MFB Pro) Corrected preview styling for single carousel effects.
Improved – (MFB Pro) Removed unnecessary values when selecting paths for SFB, background image, video, or overlay color.
Improved – (MFB Pro) Added support for selecting sub-paths when binding a text field as the label for a bound button.
Improved – (MFB Pro) Added support for selecting sub-paths when binding a URL field as the URL for a bound image.
1.4.3
Release Date – 17 June 2025
Improved – Added error handling for get_term_link to prevent string casting errors.
Added – (MFB Pro) Allowed binding a text field as the label for a button created from a URL field.
Added – (MFB Pro) Displaying a group field as a details block, and displaying a repeater or cloned group as an accordion.
Improved – (MFB Pro) Allowed selecting a field path for sub-field blocks instead of entering it manually.
1.4.2
Release Date – 12 May 2025
Improved – Ignored the cloneable setting for Meta Box image-related and choice-related field types
Added – (MFB Pro) Set a video sub-field as the background video of a parent group field.
Added – (MFB Pro) Bind a sub color field to the overlay color feature.
Improved – (MFB Pro) Handle missing media uploads for button and image block bindings.
Improved – (MFB Pro) Render only one item as the fallback value for a single ACF Post Object field.
Improved – (MFB Pro) Allow displaying the sample ID input setting when choosing the meta type as ‘post’ and the current post type is not post or page
1.4.1
Release Date – 28 April 2025
Fixed – (MFB Pro) The target attribute of the ACF link was not binding correctly.
Fixed – (MFB Pro) Removed the duplicate store registration warning.
Fixed – (MFB Pro) Error when the hosting environment does not support mb_encode_numericentity.
Improved – (MFB Pro) Preload layout for carousels is now calculated correctly before the script executes.
Improved – (MFB Pro) Don’t show carousel preview in the Block Editor on Mobile and Tablet modes
Improved – (MFB Pro) Some small adjustments on the carousel layout
1.4
Release Date – 14 April 2025
Added – Supported most of field types for the Meta Box framework.
Added – (MFB Pro) Display the ACF repeater field in a carousel layout besides group, row, stack and grid layout.
Added – (MFB Pro) Display the ACF gallery field as a carousel of images.
Added – (MFB Pro) Set an image sub-field as the background image of a parent group field.
Added – (MFB Pro) Most Meta Box complex fields have PRO features similar to ACF fields.
Added – [MFB Pro] Background overlay and doutone to background images.
Improved – [MFB Pro] Add block bindings to image and button blocks.
Added – Supported displaying post title with MFB.
Added – Shadow, heading color support features.
Improved – Add new hook meta_field_block_ignore_wrapper_block to allow omitting the block wrapper, prefix, suffix in the output.
Improved – Add new hook meta_field_block_ignore_prefix_suffix to allow omitting the prefix, suffix in the output.
Improved – Add new hook meta_field_block_get_block_wrapper_extra_attributes to allow adding custom attributes to the block wrapper.
Changed – Replace the hook meta_field_block_acf_field_true_false_on_text by the hook meta_field_block_true_false_on_text. The new hook can be applied to both ACF and Meta Box fields.
Changed – Replace the hook meta_field_block_acf_field_true_false_off_text by the hook meta_field_block_true_false_off_text. The new hook can be applied to both ACF and Meta Box fields.
Fixed – Non UTF-8 characters in button’s text are rendered incorrect
1.3.5
Release Date – 13 February 2025
Fixed – (MFB Pro) Load alt text for gallery images
1.3.4
Release Date – 27 January 2025
Improved – (MFB Pro) Allow custom sorting with the nested Query Loop for the relationship field
Fixed – (MFB Pro) Load all posts stored in the relationship field for the Query Loop
Updated – Freemius SDK 2.11.0
1.3.3
Release Date – 06 January 2025
Fixed – (MFB Pro) ACF Relationship field and custom post types
Improved – (MFB Pro) Add the plugin version to the premium style file
Updated – Update Freemius SDK 2.10.1
1.3.2
Release Date – 17 November 2024
Improved – Updated translation text for compatibility with WordPress 6.7
1.3.1
Release Date – 28 October 2024
Improved – Prevent inner links from being clickable in the editor
Improved – Add code to check if the post and term exist before displaying them
Updated – Upgrade to Freemius SDK 2.9.0
1.3.0
Release Date – 05 August 2024
Added – (MFB Pro) Register custom bindings for heading and paragraph when displaying a text field as a heading or a paragraph block
Added – (MFB Pro) Allow linking an image field to a custom URL from another field
Improved – (MFB Pro) Display dynamic value in the editor when displaying a field as a heading, paragraph, button, image, or video block
Improved – (MFB Pro) Allow displaying the value of URL, and email as button text when displaying them as a button
Fixed – (MFB Pro) Expanding image is not getting dynamic value
Refactor – Replaced classnames with clsx
Refactor – Replace useSetting by useEttings
Updated – Tested up to 6.5 for block bindings
1.2.14
Release Date – 31 July 2024
Improved – Escape the style attribute for prefix and suffix
1.2.13
Release Date – 17 July 2024
Improved – Ignore array and object fields from the list of suggested names in the meta field type
Improved – MFB Pro: Change the label with mailto prefix to the mail value
Updated – Update Freemius SDK to 2.7.3
1.2.11
Release Date – 06 June 2024
Added – Support clientNavigation interactivity
Added – Allow changing the object type via the new filter meta_field_block_get_object_type
Improved – MFB Pro: Use useEntityRecord to display suggested names for setting fields
1.2.10
Release Date – 07 May 2024
Added – Add correct format for ACF textarea and editor field in the editor
Updated – Use useSettings instead of useSetting since WP 6.5
Improved – Flush server cache for object type and ACF fields when necessary
Improved – Add field label to the layout variations of SFB: Group, Flexible content, Repeater
Improved – MFB Pro: Don’t allow editing field path for repeater items SFB
Improved – MFB Pro: Flexible content field type
1.2.9
Release Date – 01 May 2024
Improved – Invalidate the MFB cache when updating a post, a term, a user, or settings
Updated – Help text in the settings page
1.2.8
Release Date – 22 April 2024
Updated – Since WP 6.5 we could not get the post ID and post type from the current context when accessing the template editor from a post/page.
Added – Add the emptyMessage feature to static blocks
1.2.7
Release Date – 16 April 2024
Added – Support displaying custom fields inside the Woo Product Collection block
1.2.6
Release Date – 22 March 2024
Added – Add query, and queryId of Query Loop as context parameters
Updated – PRO: Render nested ACF oEmbed fields
1.2.5
Release Date – 11 March 2024
Updated – Update inline documentation
Fixed – When front-end forms are submitted to admin-post.php, nopriv users are redirected to the login page.
Added – PRO: Display ACF gallery field
Added – PRO: Display ACF File as a video
1.2.4
Release Date – 22 February 2024
Added – Add typography and gap settings to prefix and suffix
Removed – Remove the redundant blockGap support feature
Improved – Remove _acf_changed from the list of suggested names
Fixed – Remove the block margin on value, prefix and suffix when the block is used inside a flow-layout block
Fixed – PRO: Correct the name for some field types for ACF
Added – PRO: Enable the hideEmpty setting for static blocks
Improved – PRO: Change the default perPage value for ACF query fields from 100 to 12
Added – PRO: Add the linkToPost setting to the ACF image field and ACF URL-as-image field
1.2.3
Release Date – 24 January 2024
Added – New dynamic field type to display private fields, support running shortcodes, and see the changes made by the hook meta_field_block_get_block_content both on the front end and the editor.
Updated – Change the name of a private hook from ‘_meta_field_block_get_field_value’ to ‘_meta_field_block_get_field_value_other_type’
Updated – Change the permission for getting custom endpoints from publish_posts to edit_posts
1.2.2
Release Date – 08 January 2024
Updated – Adjust the configuration for freemius
1.2.1
Release Date – 03 January 2024
Updated – Support full attributes for SVG and all basic shapes in the allowed HTML tags
Added – Add the settings page with guides
Added – Integrate with freemius 2.6.2
Updated – Add the section tag to the list of HTML tag
Updated – Ignore footnotes from the suggested values for the meta field name
Updated – Update Requires at least to 6.3
1.2
Release Date – 11 December 2023
Added – Allow getting meta fields from terms and users
Updated – Add new $object_type parameter to two main hooks meta_field_block_get_acf_field and meta_field_block_get_block_content
Added – Add variations for some common ACF field types
Updated – Increase the required version of PHP to 7.4
Updated – Refactor code for upcoming releases
Updated – Move the prefix and suffix to a separate panel
1.1.7
Release Date – 09 September 2023
FIX – The block does not show the number 0 if using it as the empty message
1.1.6
Release Date – 13 August 2023
DEV – Refactor block.json, update to block API version 3 for better WP 6.3 compatibility
FIX – Rename allowed HTML attributes for SVG
1.1.5
Release Date – 15 July 2023
DEV – Add a custom hook apply_filters( 'meta_field_block_kses_allowed_html', $allowed_html_tags ) for filtering allowed HTML tags in the value.
DEV – Allow displaying iframe, and SVG tag by default.
DEV – Force displaying color (text, background, link) attributes for unsupported themes.
DEV – Refactor code for React best practice.
DOC – Update readme for the hook meta_field_block_get_acf_field
1.1.4
Release Date – 20 May 2023
DEV – Change the placeholder text for the block in the site editor.
DEV – Add a setting to use the ACF field label as the prefix
1.1.3
Release Date – 31 Mar 2023
DEV – Support choice fields: true/false, select, checkbox, radio, button group
DEV – Add raw value to the meta_field_block_get_acf_field hook
1.1.2
Release Date – 28 Mar 2023
DEV – Refactor both JS and PHP code
DEV – Load ACF field value even if we could not load the field object
DEV – Separate settings group for WP 6.2
1.1.1
Release Date – 14 Mar 2023
DEV – Add a hideEmpty setting to hide the whole block if the value is empty
DEV – Add an emptyMessage setting to show a custom text in case the value is empty
FIX – The meta field did not show on the archive template
1.1.0
Release Date – 06 Mar 2023
DEV – Refactor all the source code for more upcoming features
DEV – Make sure the block works with all return formats for the image field, link field
DEV – Get all custom rest fields to show on the suggested help
DEV – Allow changing the tagName from the block toolbar
DEV – Improve performance
DEV – Add more core support features
DEV – Add more meaningful messages for some use cases
FIX – Allow displaying links without text
1.0.10
Release Date – 02 Feb 2023
DEV – Support multiple values for ACF User type
1.0.9
Release Date – 15 Sep 2022
FIX – Change the textdomain to the plugin slug
1.0.8
Release Date – 10 Sep 2022
FIX – Wrong handle for wp_set_script_translations. Thanks to Loïc Antignac (@webaxones)
1.0.7
Release Date – 07 Sep 2022
FIX – Add a null check for meta fields value before accessing it’s property
1.0.6
Release Date – 25 Jun 2022
DEV – Add an option to show the block’s outline on the Editor
1.0.5
Release Date – 21 Jun 2022
DEV – Display the placeholder text on the template context
1.0.4
Release Date – 02 May 2022
DEV – Support displaying some field types for ACF such as image, link, page_link, post_object, relationship, taxonomy
1.0.3
Release Date – 30 April 2022
DEV – Add supports for borders, and full typography options