Meta Field ブロック

説明

こちらのシングルブロックプラグインを使用すると、メタフィールドやカスタムフィールドをフロントエンドでブロックとして表示できます。投稿、ターム、およびユーザーのカスタムフィールドに対応しています。Query ブロックWooCommerce Product Collection など、postIdpostType のコンテキストを持つ親ブロック内にネストして使用することも、単体のブロックとして使用することもできます。

コア API で取得できる値を持つフィールド (get_post_meta, get_term_meta, get_user_meta) の値が文字列であるか、文字列に変換できる場合に、フィールドの値を表示できます。ブロックエディターでフィールドの値を表示するには、それが REST API 経由でアクセス可能であるか、またはフィールドタイプが dynamic に設定されている必要があります。

Advanced Custom FieldsMeta Box プラグインで作成されたカスタムフィールドも明示的に表示することができます。すべての ACF のフィールドタイプ および Meta Box のフィールドタイプ のうち、値が文字列であるか文字列に変換できるものに対応しています。また、ACF の複合フィールドタイプ画像、リンク、ページリンク、真 / 偽、チェックボックス、選択、ラジオボタン、ボタングループ、タクソノミー、ユーザー、投稿オブジェクト、リレーションシップや、Meta Box の選択、チェックボックス、ラジオボタン、画像、動画、タクソノミー、ユーザー、投稿などのフィールドタイプにも基本的な形式で対応しています。

当プラグインは、開発者向けにフック API も提供しており、ブロックの出力を簡単にカスタマイズしたり、複雑なデータ型フィールドを表示したり、コンテキストパラメータとして object_idobject_type を使用して任意の種類のコンテンツを表示したりすることができます。

このブロックが本当に役立つエッジケースの1つは、クエリループ内でショートコードを使用する際に post_id を取得する必要がある場合です。その場合はフィールドタイプを dynamic に設定し、フィールド名にショートコードを入力します。ブロックはフロントエンドとエディターの両方で正しく表示されます。また、エディターでショートコードのプレビューのみを表示したい場合は、core/shortcode の改良バージョンとしてもこのブロックを使用できます。

リンク

カスタムフィールドの HTML 出力とは ?

カスタムフィールドの HTML 出力は、フィールドのコンテキストに依存します。フィールド値を取得するために、次のいずれかのコアAPI関数が使用されます: get_post_meta, get_term_meta, get_user_meta.

ACF フィールドの HTML 出力とは何ですか ?

  1. すべての基本的なフィールドタイプ、文字列を返すか、文字列に変換できるものをサポート – HTML の出力は、get_field 関数により取得できます。

  2. リンクタイプ – HTML の出力:

    <a href={url} target={target} rel="noreferrer noopener">{title}</a>
    

    target_blank でない場合、rel 属性は存在しません

  3. 画像タイプ – HTML 出力は、wp_get_attachment_image 関数から取得されます。画像サイズはプレビュー サイズ設定から取得されます。

  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. チェックボックス / セレクトタイプ – HTML の出力:

    <span class="value-item">{item_value}</span>, <span class="value-item">{item_value}</span>
    

    item_value は、フィールドの戻り形式に応じて、value または label になります。複数の選択値は、, で区切られます。区切り文字を変更するコードスニペットは以下です:

    add_filter( 'meta_field_block_acf_field_choice_item_separator', function ( $separator, $field_name, $field, $post_id, $value ) {
      return ' | ';
    }, 10, 5 );
    
  6. ラジオボタン / ボタングループタイプ – HTML の出力は、フィールドの返り値フォーマットに依存しますので value または label です。

  7. ページリンクタイプ、投稿オブジェクトタイプ – 単一値フィールドの HTML 出力:

    <a class="post-link" href={url} rel="bookmark">{title}</a>
    

    複数の値を持つフィールドの場合は以下のようになります:

    <ul>
      <li><a class="post-link" href={url} rel="bookmark">{title}</a></li>
      <li><a class="post-link" href={url} rel="bookmark">{title}</a></li>
    </ul>
    
  8. リレーションシップタイプの場合は以下のようになります:

    <ul>
      <li><a class="post-link" href={url} rel="bookmark">{title}</a></li>
      <li><a class="post-link" href={url} rel="bookmark">{title}</a></li>
    </ul>
    
  9. タクソノミータイプ – HTML の出力:

    <ul>
      <li><a class="term-link" href={term_url}>{term_name}</a></li>
      <li><a class="term-link" href={term_url}>{term_name}</a></li>
    </ul>
    
  10. ユーザータイプ – 単一値フィールドの HTML 出力:

    <a class="user-link" href={author_url}>{display_name}</a>
    

    複数の値を持つフィールドの場合は以下のようになります:

    <ul>
      <li><a class="user-link" href={author_url}>{display_name}</a></li>
      <li><a class="user-link" href={author_url}>{display_name}</a></li>
    </ul>
    
  11. 他の複雑なフィールドタイプに対して、カスタム HTML 出力を生成するには、以下のフックを使用できます:

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

    または、一般的なフックを使用してもかまいません:

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

Meta Box フィールドの HTML 出力とは ?

  1. ACF フィールドと同様に、文字列を返すか、関数 rwmb_get_value で文字列にキャストできるすべての基本フィールドがサポートされています。

    複製可能な基本フィールドの HTML 出力は次のとおりです :

    <span class="value-repeater-item">{item_1_value}</span>, <span class="value-repeater-item">{item_2_value}</span>
    

    タグと区切りを変更するには、次のフックを使用します :

    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. 個別の画像タイプ – HTML出力はwp_get_attachment_image 関数
    から取得されます。画像サイズは image_size 設定から取得されます。

  3. 画像リストの種類 (画像、画像の詳細、画像のアップロード) – HTML 出力は次のとおり:

    <figure class="image-list">
      <figure class="image-item"><img /></figure>
      <figure class="image-item"><img /></figure>
    </figure>
    
  4. チェックボックス / スイッチ タイプ – ACF 真 / 偽 タイプに似ています。

  5. 複数選択タイプ (選択、高度な選択、ボタングループ、オートコンプリート、画像選択、チェックボックスリスト) – HTML の出力は次のようになります:

    <span class="value-item">{item_value}</span>, <span class="value-item">{item_value}</span>
    

    値の代わりにラベルを表示するには、次のフックを使用します:

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

    区切りを変更するには次のフックを使用します:

    apply_filters( 'meta_field_block_mb_field_choice_item_separator', ', ', $file_name, $field, $post_id, $value )
    
  6. ラジオボタン型 – デフォルトではフィールド値が出力されます。ラベルを表示したり、区切り文字を変更したりするには、複数選択型と同じフックを使用します。

  7. 投稿タイプ – 個別値フィールドの HTML 出力は次のとおりです:

    <a class="post-link" href={url} rel="bookmark">{title}</a>
    

    複数の値を持つフィールドの場合は以下のようになります:

    <ul>
      <li><a class="post-link" href={url} rel="bookmark">{title}</a></li>
      <li><a class="post-link" href={url} rel="bookmark">{title}</a></li>
    </ul>
    
  8. タクソノミー、タクソノミーの高度なタイプ – 個別値フィールドの HTML 出力は次のとおりです:

    <a class="term-link" href={term_url}>{term_name}</a>
    

    複数の値を持つフィールドの場合は以下のようになります:

    <ul>
      <li><a class="term-link" href={term_url}>{term_name}</a></li>
      <li><a class="term-link" href={term_url}>{term_name}</a></li>
    </ul>
    
  9. ユーザータイプ – ACF ユーザータイプに類似

  10. 動画タイプ – 個別値フィールドの HTML 出力は次のとおりです:

    <video controls preload="metadata" src={video_src} width={video_width} poster={poster} />
    

    複数の値を持つフィールドの場合は以下のようになります:

    <figure class="video-list">
      <figure class="video-item"><video /></figure>
      <figure class="video-item"><video /></figure>
    </figure>
    
  11. 複雑なフィールドタイプを表示したり、フィールドの出力を変更するには meta_field_block_get_mb_field フックを使用、または一般的なフック meta_field_block_get_block_content を使用します。

コピー & ペーストのスニペット

meta_field_block_get_block_content フックでブロックコンテンツをカスタマイズする場合は、フィールドタイプとして dynamic を選択することを推奨します。これにより、フロントエンドとエディターの両方に変更内容が表示されます。ACF フィールドを使用している場合は、meta_field_block_get_acf_field フックでフィールドコンテンツを変更することを推奨します。同様に、Meta Box ユーザーは、meta_field_block_get_mb_field フックでコンテンツを変更する必要があります。ACF スニペットは Meta Box フィールドでも使用できますが、正しいフック名を使用し、get_field 関数を rwmb_get_value 関数に置き換える必要があります。

  1. ブロックの HTML 出力を変更するには ?
    meta_field_block_get_block_content フックを使用します:

    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);
    

    ACF フィールドに対してのみ、フック meta_field_block_get_acf_field を使用します:

    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);
    

    こちら基本的なコードスニペットは非常に強力です。これを使用して任意の投稿、用語、ユーザー、または設定フィールドから任意のフィールドを表示できます。詳細は、以下の使用例をご覧ください。

  2. クエリループ内でブロックを投稿へのリンクでラップする方法は ?
    meta_field_block_get_block_content フックを使用します:

    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('<a href="%1$s">%2$s</a>', get_permalink($post_id), $block_content);
      }
    
      return $block_content;
    }, 10, 4);
    

    ACF フィールドに対してのみ、フック meta_field_block_get_acf_field を使用します:

    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('<a href="%1$s">%2$s</a>', get_permalink($post_id), $block_content);
      }
    
      return $block_content;
    }, 10, 4);
    

    このちらスニペットは、HTML インラインタグまたは画像のみを含むブロックでのみ機能します。

  3. 画像の URL フィールドを画像タグとして表示するには ?
    meta_field_block_get_block_content フックを使用します:

    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('<img src="%1$s" alt="your_image_url_field_name" />', esc_attr($block_content));
      }
    
      return $block_content;
    }, 10, 4);
    

    ACF フィールドに対してのみ、フック meta_field_block_get_acf_field を使用します:

    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('<img src="%1$s" alt="your_image_url_field_name" />', esc_attr($block_content));
      }
    
      return $block_content;
    }, 10, 4);
    
  4. ブロック内で複数のメタフィールドを表示する方法は ?
    例えば、ユーザーのフルネームを表示する必要があるときは、first_namelast_name という2つのメタフィールドから表示します。

    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);
    

    フィールドのタイプを dynamic に選択し、フィールド名を full_name と入力してください。

  5. 設定フィールドを表示するには ?
    例えば、サイトのフッターテンプレートパートに footer_credit という名前の設定フィールドを表示する必要があるときは、以下の手順になります。

    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. MFB をプレースホルダーとして使用しあらゆる種類のコンテンツを表示するには ?

MFB PRO で時間を節約しよう

投稿やターム、ユーザーなどシンプルなデータ型フィールドを表示するには、無料版の MFB があればよいです。MFB プロ版 を使うと、ACF 複合フィールドを扱うときに開発時間を 90% 短縮できます。これは、ACF 複合フィールド タイプを、コアのコンテナブロックと同様に機能するコンテナブロックに変換することで実現します。これにより、ACF カスタム ブロックを作成したり、ACF 複合フィールドを表示するためのカスタムコードを記述したりする必要がなくなります。
以下は、MFB プロ版 を使用しコーディングなしで投稿テンプレートを作成する方法の動画チュートリアルです。

以下は、MFB プロ版を使用して複雑なフィールドを表示する方法を示した動画チュートリアルです:

コーディングなしで投稿テンプレートを作成する方法

ACF の繰り返しフィールドをリスト、グリッド、カルーセルとして表示する方法

ACF ギャラリーのフィールドをグリッド、マーソンリー、カルーセルとして表示する方法

MFB プロ版のおもな機能:

当プラグインが役に立った場合は、WordPress.org で簡単なレビューと 評価 をお願いできますか。皆様のご協力を心より感謝いたします。

もし興味がありましたら、他のプラグインもチェックしてみてください:

  • Content Blocks Builder – このプラグインは、コードエディターを必要とすることなくブロックエディターで直接ブロック、バリエーション、パターンを作成できるようにすることで、ブロックエディターを強力なページ ビルダーに変えます。
  • SVG Block – SVG 画像をブロックとして表示するブロックです。画像やアイコン、区切り線、ボタンなどに便利です。SVG 画像をアップロードしてアイコンライブラリに読み込むことができます。
  • Icon separator – コアの区切りブロックと似ていますが、アイコンを追加できる小さなブロックです。
  • Breadcrumb Block – JSON-LD 構造化データをサポートし、WooCommerce と互換性のあるシンプルなパンくずリスト ブロック。
  • Block Enhancements – アイコン、ボックスシャドウ、トランスフォームなど、ブロックに便利な機能を追加するプラグインです。
  • Counting Number Block – カウントできる数字を表示するブロック
  • Better YouTube Embed Block – 埋め込まれた YouTube 動画のパフォーマンス問題を解決するブロック。複数の動画や再生リストを埋め込むこともできます。

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, the script and styles won’t be loaded on your page.

スクリーンショット

  • メタフィールドの設定

  • 接頭辞と接尾辞の設定

  • 接頭辞と接尾辞のスタイル

  • ACF 設定で Show in REST API 表示を有効化

ブロック

このプラグインは1個のブロックを提供します。

  • Meta Field Block Display a custom field as a block on the frontend. Supports custom fields for posts, terms, and users. Officially supports ACF, Meta Box, and all text-based meta fields.

インストール

  1. プラグインのファイルを/wp-content/plugins/meta-field-block ディレクトリにアップロードするか、WordPress のプラグイン画面よりプラグインを直接インストールします。
  2. WordPressの「プラグイン」画面よりプラグインを有効化してください

FAQ

このプラグインはどんな人に必要ですか ?

このプラグインは開発者向けに作成されました、もちろんエンドユーザーも使うことができます。

メタ値の入力と保存をサポートしていますか ?

いいえ、提供しません。このブロックはメタフィールドをブロックとして表示するだけです。

すべての種類のメタフィールドをサポートしていますか ?

単純な型、例えば文字列、整数、または数値のような基本的な型のみが直接使用できます。オブジェクトや配列などの他の複雑な型は、HTML マークアップ文字列に変換する必要があります。

すべての種類の ACF フィールドをサポートしていますか ?

文字列を返すか文字列にキャストするすべての基本フィールドタイプをサポートします。image、link、page_link、post_object、relationship、taxonomy、user などの複雑なフィールド タイプも基本形式でサポートされます。Group、Repeater、Flexible Content、Gallery、File などの ACF の複合フィールド タイプを表示するには、MFB プロ版 を購入するか、フック API を使用して独自のカスタムコードを作成する必要があります。

Meta Box のフィールドのすべてのタイプをサポートしていますか ?

すべての基本フィールドタイプに加え、画像、動画、選択フィールド、タクソノミー、ユーザー、投稿など一部の複雑なフィールドタイプにも基本的な形式で対応しています。その他の複雑なフィールドタイプについては、組み込みフックを使用してカスタムマークアップで表示できます。MFB プロ版 では、グループフィールドをコンテナブロックとして、クローン可能グループフィールドをグループ、行、スタック、グリッド、またはカルーセルレイアウトの繰り返しブロックとして、投稿フィールドをクエリーループとして、画像リストフィールドをグリッドまたはマー ソンリーレイアウトのギャラリーとして、または画像カルーセルとして表示できます。

接頭辞と接尾辞は何のためにあるのでしょうか ?

これらの設定の値は、プレーンテキストまたは許可された HTML 要素である必要があります。これらの値は、wp_kses( $prefix, wp_kses_allowed_html( "post" ) ) でフォーマットされます。これらの設定は、メタフィールドの名前や接頭辞または接尾辞を持つ値など、いくつかのユースケースに役立ちます。たとえば、$100、100pxなどです。

メタフィールドに対してスタイルは含まれていますか ?

このブロックは、メタフィールドの値に対して特定の CSS スタイルを提供しません。そのかわり設定から基本的なインラインスタイルを提供します。

他のメタフィールドフレームワークをサポートしていますか ?

はい、可能です。ただし、それらのメタフィールドが get_post_metaget_term_meta、または get_user_meta 関数を介してアクセス可能で、戻り値が文字列または文字列にキャストできる場合に限ります。ブロックエディターで値を表示するには、メタフィールドに REST API 経由でアクセスする必要があります。

表示されるマークアップが空白、またはメタフィールドの値と異なる場合はどうなりますか ?

メタ値には、許可されていない HTML タグや HTML 属性が含まれている可能性があります。これを修正するには、許可されたタグと属性の配列にタグと属性を追加するためのフィルターフック apply_filters( 'meta_field_block_kses_allowed_html', $allowed_html_tags ) を使用します。デフォルトでは、このブロックは$allowedposttags の値からすべてのタグと、iframe および SVG 要素のための基本的な属性を許可します。

コンテンツをサニタイズしたくない場合は、apply_filters( 'meta_field_block_kses_content', false, $attributes, $block, $post_id, $object_type, $content ) フックを使用してください。ただし正当な理由がない限り、このフックは推奨しません。

評価

2025年6月26日 1 reply
Really useful and well working plugin for displaying ACF fields in templates including repeater fields. Awesone friendly and quick support!
2025年5月18日 1 reply
Wow – been a couple of years since I logged into wp.org This plugin is just the thing needed to display custom fields on the front end without messing with php templates or dealing with the bloat of a page builder. I’m looking forward to getting the Pro version.
2025年4月22日 1 reply
I was struggling with showing some dynamic content in query loop, with help of this plugin I easily resolved it. This block even support shorcode, so you create your dynamic field structure your way by using any shortcode creation plugin and just put that shortcode in this field option and wow its clearly understand the loop context and show it correctly.
2025年3月3日 1 reply
Very handy when using Gutenberg, and cherry on the cake, the hooks for devs. Thanks!
51件のレビューをすべて表示

貢献者と開発者

Meta Field ブロック はオープンソースソフトウェアです。以下の人々がこのプラグインに貢献しています。

貢献者

“Meta Field ブロック” は6ロケールに翻訳されています。 翻訳者のみなさん、翻訳へのご協力ありがとうございます。

“Meta Field ブロック” をあなたの言語に翻訳しましょう。

開発に興味がありますか ?

コードを閲覧するか、SVN リポジトリをチェックするか、開発ログRSS で購読してみてください。

変更履歴

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

1.0.2

Release Date – 28 April 2022

  • DEV – Add the title to block registration in JS
  • REFACTOR source code

1.0.1

Release Date – 23 March 2022

  • FIX – The block does not work in the site editor.

1.0.0

Release Date – 22 February 2022