WordPress OSINT, maintenance or security needs? Reach out!
TLDWP

Plugin: display-a-meta-field-as-block (Used by 449 domains)

Meta Field Block

πŸ‘€ Phi Phan πŸ“¦ v1.5.2 πŸ”— Plugin Homepage

This single-block plugin allows you to display a meta field or a custom field as a block on the front end. 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 Block, WooCommerce Product Collection, 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.

Links

What is the HTML output of a custom field?

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?

  1. All basic field types that return strings or can cast to strings are supported – The HTML output is from the get_field function.

  2. Link type – The HTML output is:

    {title}
    

    There is no rel attribute if the target is not _blank

  3. Image type – The HTML output is from the wp_get_attachment_image function. The image size is from the Preview Size setting.

  4. True / False type – The HTML output is Yes if the value is true, and No if the value is false. Below is the code snippet to change these text values:

    add_filter( 'meta_field_block_true_false_on_text', function ( $on_text, $field_name, $field, $post_id, $value ) {
      return 'Yep';
    }, 10, 5 );
    
    add_filter( 'meta_field_block_true_false_off_text', function ( $off_text, $field_name, $field, $post_id, $value ) {
      return 'Noop';
    }, 10, 5 );
    
  5. Checkbox / Select type – The HTML output is:

    {item_value}, {item_value}
    

    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:

    add_filter( 'meta_field_block_acf_field_choice_item_separator', function ( $separator, $field_name, $field, $post_id, $value ) {
      return ' | ';
    }, 10, 5 );
    
  6. Radio button / Button group type – The HTML output can be either value or label, depending on the return format of the field.

  7. Page link type, Post object type – The HTML output for a single-value field is:

    {title}
    

    For a multiple-value field is:

    
    
  8. Relationship type – The HTML output is:

    
    
  9. Taxonomy type – The HTML output is:

    
    
  10. User type – The HTML output for a single-value field is:

    {display_name}
    

    For a multiple-value field is:

    
    
  11. For other complex field types, you can generate a custom HTML output by using the hook:

    apply_filters( 'meta_field_block_get_acf_field', $field_value, $post_id, $field, $raw_value, $object_type )
    

    Or by using the general hook:

    apply_filters( 'meta_field_block_get_block_content', $content, $attributes, $block, $object_id, $object_type )
    

What is the HTML output of Meta Box fields?

  1. Similar to ACF fields, all basic fields that return strings or can cast to strings using the function rwmb_get_value are supported.

    The HTML output of cloneable basic fields is:

    {item_1_value}, {item_2_value}
    

    Use the following hooks to change the tag and the separator:

    apply_filters( 'meta_field_block_mb_clone_field_item_separator', ', ', $field, $post_id, $field_value )
    apply_filters( 'meta_field_block_mb_clone_field_item_tag', 'span', $field, $post_id, $field_value )
    
  2. Single image types – The HTML output is from the wp_get_attachment_image function. The image size is from the image_size setting.

  3. Image list types (Image, Image advanced, Image upload) – The HTML output is:

  4. Checkbox / Switch type – Similar to ACF True / False type.

  5. Multi-choice types (Select, Select advanced, Button group, Autocomplete, Image select, Checkbox list) – The HTML output is:

    {item_value}, {item_value}
    

    To display the label instead of the value, use this hook:

    apply_filters( 'meta_field_block_mb_field_choice_item_display_label', false, $field_name, $field, $post_id, $value )
    

    To change the separator, use this hook:

    apply_filters( 'meta_field_block_mb_field_choice_item_separator', ', ', $file_name, $field, $post_id, $value )
    
  6. Radio type – The output is the field value by default. To display label or change the separator, use the same hooks as the multi-choice types.

  7. Post type – The HTML output for a single-value field is:

    {title}
    

    For a multiple-value field is:

    
    
  8. Taxonomy, Taxonomy advanced type – The HTML output for a single-value field is:

    {term_name}
    

    For a multiple-value field is:

    
    
  9. User type – Similar to ACF User type

  10. Video type – The HTML output for a single-value field is:

    For a multiple-value field is:

  11. 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.

  1. How to change the HTML output of the block?
    Using the meta_field_block_get_block_content hook:

    add_filter( 'meta_field_block_get_block_content', function ( $block_content, $attributes, $block, $post_id, $object_type ) {
      $field_name = $attributes['fieldName'] ?? '';
    
      if ( 'your_unique_field_name' === $field_name ) {
        $block_content = 'new content';
      }
    
      return $block_content;
    }, 10, 5);
    

    Using the meta_field_block_get_acf_field hook for ACF Fields only:

    add_filter( 'meta_field_block_get_acf_field', function ( $block_content, $post_id, $field, $raw_value, $object_type ) {
      $field_name = $field['name'] ?? '';
    
      if ( 'your_unique_field_name' === $field_name ) {
        $block_content = 'new content';
      }
    
      return $block_content;
    }, 10, 5);
    

    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.

  2. How to wrap the block with a link to the post within the Query Loop?
    Using the meta_field_block_get_block_content hook:

    add_filter( 'meta_field_block_get_block_content', function ( $block_content, $attributes, $block, $post_id ) {
      $field_name = $attributes['fieldName'] ?? '';
    
      if ( 'your_unique_field_name' === $field_name && $block_content !== '' ) {
        $block_content = sprintf('%2$s', get_permalink($post_id), $block_content);
      }
    
      return $block_content;
    }, 10, 4);
    

    Using the meta_field_block_get_acf_field hook for ACF Fields only:

    add_filter( 'meta_field_block_get_acf_field', function ( $block_content, $post_id, $field, $raw_value ) {
      $field_name = $field['name'] ?? '';
    
      if ( 'your_unique_field_name' === $field_name && $block_content !== '' ) {
        $block_content = sprintf('%2$s', get_permalink($post_id), $block_content);
      }
    
      return $block_content;
    }, 10, 4);
    

    This snippet only works with the block that has only HTML inline tags or an image.

  3. How to display an image URL field as an image tag?
    Using the meta_field_block_get_block_content hook:

    add_filter( 'meta_field_block_get_block_content', function ( $block_content, $attributes, $block, $post_id ) {
      $field_name = $attributes['fieldName'] ?? '';
    
      if ( 'your_image_url_field_name' === $field_name && wp_http_validate_url($block_content) ) {
        $block_content = sprintf('your_image_url_field_name', esc_attr($block_content));
      }
    
      return $block_content;
    }, 10, 4);
    

    Using the meta_field_block_get_acf_field hook for ACF Fields only:

    add_filter( 'meta_field_block_get_acf_field', function ( $block_content, $post_id, $field, $raw_value ) {
      $field_name = $field['name'] ?? '';
    
      if ( 'your_image_url_field_name' === $field_name && wp_http_validate_url($block_content) ) {
        $block_content = sprintf('your_image_url_field_name', esc_attr($block_content));
      }
    
      return $block_content;
    }, 10, 4);
    
  4. How to display multiple meta fields in a block?
    For example, we need to display the full name of a user from two meta fields first_name and last_name.

    add_filter( 'meta_field_block_get_block_content', function ( $block_content, $attributes, $block, $post_id ) {
      $field_name = $attributes['fieldName'] ?? '';
    
      if ( 'full_name' === $field_name ) {
        $first_name = get_post_meta( $post_id, 'first_name', true );
        $last_name  = get_post_meta( $post_id, 'last_name', true );
    
        // If the meta fields are ACF Fields. The code will be:
        // $first_name = get_field( 'first_name', $post_id );
        // $last_name  = get_field( 'last_name', $post_id );
    
        $block_content = trim("$first_name $last_name");
      }
    
      return $block_content;
    }, 10, 4);
    

    Choose the field type as dynamic and input the field name as full_name.

  5. How to display a setting field?
    For example, we need to display a setting field named footer_credit on the footer template part of the site.

    add_filter( 'meta_field_block_get_block_content', function ( $block_content, $attributes, $block, $post_id ) {
      $field_name = $attributes['fieldName'] ?? '';
    
      // Replace `footer_credit` with your unique name.
      if ( 'footer_credit' === $field_name ) {
        $block_content = get_option( 'footer_credit', '' );
    
        // If the field is an ACF Field. The code will be:
        // $block_content = get_field( 'footer_credit', 'option' );
      }
    
      return $block_content;
    }, 10, 4);
    
  6. How to use MFB as a placeholder to display any kind of content?

SAVE YOUR TIME WITH MFB PRO

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

The main features of MFB PRO are:

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 – This plugin turns the Block Editor into a powerful page builder by allowing you to create blocks, variations, and patterns directly in the Block Editor without needing a code editor.
  • 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.
  • Counting Number Block – A block to display numbers with a counting effect
  • Better YouTube Embed Block – A block to solve the performance issue with embedded YouTube videos. It can also embed multiple videos and playlists.

The plugin is built using @wordpress/create-block.
MFB is developed using only native Gutenberg features to keep it fast and lightweight.
MFB Pro uses SwiperJS for the carousel layout. However, if you don’t use the carousel layout, …

DomainExposuresHeadersLast Checked
c*n*g*e*n.com (WP 6.9.4) βœ… F 2026-04-24 15:11:32
e*o*l*u.fr (WP 6.9.4) βœ… F 2026-04-24 13:06:08
v*e*e*i*i*u*e.fr βœ… D 2026-04-24 08:26:09
s*m*n*i*b*r*.com (WP 6.9.4) βœ… F 2026-04-24 05:58:47
p*t*t*e*w*t*o*t*o*d*r*.com βœ… D 2026-04-23 22:53:16
k*f*e*r*n*e.de (WP 6.9.4) βœ… F 2026-04-23 19:13:53
c*n*a*n.org (WP 6.9.4) βœ… F 2026-04-23 19:10:49
m*.w*a.org βœ… A 2026-04-23 19:02:51
s*l*c*n*r*i*i*n*w*.com βœ… F 2026-04-23 18:29:03
c*d*l*w.com βœ… F 2026-04-23 15:32:51
c*a*t*r*u*z*e*i*.com βœ… F 2026-04-23 12:57:45
m*z*y*k*-*a*a.com (WP 6.9.4) βœ… F 2026-04-23 11:34:29
a*a*a*a*.com (WP 6.9.4) βœ… F 2026-04-23 10:48:52
c*m*e*s*y*e.de (WP 6.9.4) βœ… C 2026-04-23 10:24:47
u*a*i*m*r*d*c*i*n*.com (WP 6.9.4) βœ… F 2026-04-23 07:11:05
e*o*-*o*a*s*i.com βœ… D 2026-04-23 06:19:35
b*t*e*-*o*e.fr βœ… B 2026-04-23 06:00:49
p*f*i*t*e*o*n.com βœ… D 2026-04-23 04:11:25
p*f*i*i*a*.com βœ… D 2026-04-23 04:11:24
p*f*s*f*.com βœ… D 2026-04-23 04:11:23
p*f*l*n*o*.com βœ… D 2026-04-23 04:11:23
p*f*l*t*l*j*h*.com βœ… D 2026-04-23 04:11:23
p*f*l.com βœ… D 2026-04-23 04:11:23
p*f*i.com βœ… D 2026-04-23 04:11:23
l*d*a*j*.live βœ… D 2026-04-23 04:09:23
k*n*o*n*w*e*i*.com βœ… F 2026-04-23 01:00:38
q*i*c*i*s*.org βœ… F 2026-04-22 22:31:41
n*t*w*r*-*r*i*-*u*t*r.de βœ… F 2026-04-22 21:47:55
t*e*n*o*a*i*n*o*p*n*.fr βœ… F 2026-04-22 21:10:52
p*t*s*u*g*h*m*i*s*e*t*o*.com βœ… F 2026-04-22 20:58:40
c*n*e*t*.de βœ… F 2026-04-22 20:09:37
l*c*e*c*o*d*.com (WP 6.9.4) βœ… B 2026-04-22 13:06:16
m*n*v*g*t*r.org βœ… F 2026-04-22 08:28:01
l*u*e*m*r*u*z.com (WP 6.9.4) βœ… C 2026-04-22 08:06:33
l*k*e*i*.com βœ… F 2026-04-22 01:47:41
o*c*m*.site (WP 6.9.4) βœ… F 2026-04-22 01:44:30
k*o*s*l*s.com βœ… F 2026-04-21 22:32:40
t*r*s*x.com (WP 6.9.4) βœ… F 2026-04-21 20:08:17
t*r*s*c*s.com (WP 6.9.4) βœ… F 2026-04-21 20:08:16
t*r*s*c*.com (WP 6.9.4) βœ… F 2026-04-21 20:08:16
a*t*m.no βœ… F 2026-04-21 17:03:15
c*m*e*s*y*e.it (WP 6.9.4) βœ… D 2026-04-21 16:40:40
c*m*e*-*t*l*.pl (WP 6.9.4) βœ… D 2026-04-21 16:40:40
c*m*e*s*y*e.tr (WP 6.9.4) βœ… D 2026-04-21 16:40:40
c*m*e*s*y*e.fr (WP 6.9.4) βœ… D 2026-04-21 16:40:40
c*m*e*-*t*l*.nl (WP 6.9.4) βœ… D 2026-04-21 16:40:40
c*m*e*s*y*e.es (WP 6.9.4) βœ… D 2026-04-21 16:40:40
c*b*r*t*l*n*o*i*e.com βœ… F 2026-04-21 15:34:06
p*t*t*p*s*t*v*.org βœ… F 2026-04-21 15:23:13
b*e*s*d*o*o*r*w.org βœ… F 2026-04-21 15:23:13
c*i*a*e*o*h*a*t*.org βœ… F 2026-04-21 15:23:13
f*n*m*t*x*r*d*t*.com βœ… F 2026-04-21 15:19:26
t*e*i*c*.no βœ… F 2026-04-21 10:35:47
c*n*e*t*.ch βœ… F 2026-04-21 08:54:39
y*t*a*s*o*t*t*o*.org βœ… F 2026-04-21 08:33:58
r*d*.com (WP 6.9.4) βœ… D 2026-04-21 07:58:58
o*i*n*s*u*e*.com βœ… D 2026-04-21 07:04:39
f*n*n*e*n*f*i*a.com (WP 6.9.4) βœ… F 2026-04-21 06:21:54
m*r*u*y*a*p*o*.com (WP 6.9.4) βœ… F 2026-04-21 04:05:21
t*r*t*e*i*e.com (WP 6.9.4) βœ… F 2026-04-20 21:17:19
a*e*l*n*d*v*l*p*e*t*.com βœ… F 2026-04-20 21:02:27
o*d*s*u*e.com (WP 6.9.4) βœ… F 2026-04-20 20:44:06
l*m*l*o*.de (WP 6.9.4) βœ… F 2026-04-20 17:55:37
r*p*n*o*i*t*.com βœ… C 2026-04-20 16:25:21
d*x*e*.com (WP 6.9.4) βœ… F 2026-04-20 16:05:22
d*v*p*c*n*r*v*l*e*o*r*.com βœ… A 2026-04-20 13:54:40
a*c*a*l*n*a.com βœ… F 2026-04-20 11:07:59
a*c*a*l.com βœ… F 2026-04-20 11:07:59
b*i*d*n*s*a*t*v*r*a*.de (WP 6.9.4) βœ… D 2026-04-20 04:55:14
k*m*o*e*a*d*o.com βœ… F 2026-04-19 22:57:12
s*e*a*s*u*i*-*7.com βœ… F 2026-04-19 22:47:11
a*u*t*n*a*x*i.com βœ… D 2026-04-19 22:35:53
d*s*g*e*h*p*y*o*r.com βœ… F 2026-04-19 15:13:15
o*l*o*h*r*e*.com βœ… F 2026-04-19 08:57:13
j*c*u*s*o*g*n*t.com βœ… F 2026-04-19 08:26:07
e*x*o*a*t*.com βœ… A 2026-04-19 07:17:40
1*a*t*o*h.com (WP 6.9.4) βœ… F 2026-04-19 06:25:13
a*t*m*b*l*e*z*.ru (WP 6.9.4) βœ… D 2026-04-19 01:23:05
o*i*i*l*y*-*i*e*-*i*i*n*.ru (WP 6.9.4) βœ… D 2026-04-19 01:23:04
t*u*t*r*r*g.com (WP 6.9.4) βœ… F 2026-04-18 23:50:36
s*a*t*h*s*o.com (WP 6.9.4) βœ… F 2026-04-18 23:05:33
a*f*r*e*t*n*.b*a*d*n*u*g.de βœ… D 2026-04-18 22:32:27
f*y*e*h*.com βœ… D 2026-04-18 22:14:07
o*i*n.com (WP 6.9.4) βœ… F 2026-04-18 21:00:53
k*w*i*e*a*d*.com βœ… B 2026-04-18 13:58:11
v*n*o*v*r*r*s*u*i*s.com (WP 6.9.4) βœ… F 2026-04-18 12:14:50
k*t*w*l*n*s*.com βœ… F 2026-04-18 10:04:23
r*s*e*t*i*e*t*a*t*.com βœ… F 2026-04-18 06:43:24
t*i*l*d*i*d*i*e.com βœ… F 2026-04-18 01:57:36
h*n*a*e*r*t.de βœ… D 2026-04-18 00:43:18
t*i*i*y*u*t*m.com βœ… F 2026-04-17 22:56:18
b*s*i*t*o*i*t*.org (WP 6.9.3) βœ… F 2026-04-17 21:33:29
t*i*l*u*s*r*n*q*a*t*t.com (WP 6.9.4) βœ… F 2026-04-17 21:03:49
m*p.vc βœ… F 2026-04-17 19:20:57
t*i*u*e*p*.com (WP 6.9.4) βœ… F 2026-04-17 17:16:46
s*r*u*v*z.com βœ… F 2026-04-17 08:49:38
s*r*u*-*t*d*o*.com βœ… F 2026-04-17 08:36:07
s*r*u*-*a*s.com βœ… F 2026-04-17 08:36:06
d*e*d*v*w*.com (WP 6.9.4) βœ… F 2026-04-17 07:30:06
o*f*n.com (WP 6.9.4) βœ… F 2026-04-17 07:18:19

Top 50 Plugins

Plugin Count
elementor 2,134,436
contact-form-7 1,987,130
elementor-pro 1,215,614
woocommerce 991,424
revslider 730,564
js_composer 489,156
jetpack 477,262
wp-rocket 363,373
essential-addons-for-elementor-lite 327,861
gravityforms 277,028
header-footer-elementor 266,685
complianz-gdpr 255,279
instagram-feed 253,476
google-analytics-for-wordpress 249,228
elementskit-lite 249,035
gutenberg-core 246,878
cookie-law-info 245,100
google-site-kit 244,358
sitepress-multilingual-cms 224,973
bluehost-wordpress-plugin 212,938
wpforms-lite 180,009
astra-sites 172,308
gutenberg 160,540
litespeed-cache 159,574
cookie-notice 145,251
gtranslate 145,020
coblocks 135,812
the-events-calendar 132,477
popup-maker 124,886
astra-addon 107,626
bb-plugin 106,998
tablepress 106,055
LayerSlider 105,363
wp-smushit 104,444
premium-addons-for-elementor 103,465
woocommerce-payments 101,228
mailchimp-for-wp 101,138
duracelltomi-google-tag-manager 96,938
honeypot 94,491
cleantalk-spam-protect 93,970
akismet 93,550
woocommerce-gateway-stripe 92,079
megamenu 89,459
creame-whatsapp-me 88,040
fusion-builder 87,490
smart-slider-3 86,311
formidable 85,167
all-in-one-seo-pack 84,707
pixelyoursite 83,486
pro-elements 83,391

Top 50 Themes

Theme Count
hello-elementor 703,507
Divi 584,993
astra 541,268
pub 167,274
Avada 134,782
generatepress 132,462
flatsome 132,067
oceanwp 96,456
h4 93,711
kadence 87,540
enfold 77,081
salient 74,150
bb-theme 66,776
twentytwentyfour 65,676
blocksy 60,924
twentyseventeen 60,696
cocoon-master 60,407
betheme 58,908
twentytwentyfive 58,322
dt-the7 50,019
woodmart 43,648
neve 43,495
twentytwentyone 37,716
Avada-Child-Theme 37,521
bridge 37,032
gox 35,255
twentytwenty 33,282
lightning 32,380
swell 31,887
twentytwentythree 30,203
bricks 27,398
Impreza 27,306
Newspaper 24,555
twentytwentytwo 24,043
epik-redesign 21,966
pro 20,182
storefront 20,026
uncode 19,959
extendable 19,952
twentysixteen 19,770
sydney 18,116
yith-wonder 17,850
themify-ultra 16,415
Total 16,114
twentyfifteen 14,524
hestia 14,237
porto 14,110
twentynineteen 13,634
yootheme 13,525
thrive-theme 13,408