# gb\_get\_field()

**Experimental Feature @since v1.0.0-RC4.2.0**&#x20;

A GutenBricks block can store meta value. If you're using ACF or Metabox fields to create input fields, their values are saved within the block. The values are retrieve as dynamic data in Bricks (For eg. `{acf_example}`)

Sometimes, the code editor you're working on may not support dynamic data or has no access to meta data saved in Blocks. For example, the PHP editor inside Bricks Builder's Query Loop does not access Block meta data.&#x20;

**In this case, you can use `gb_get_field($key, $post_id, $args)` function to retrieve the value instead.**

* This method works for both ACF and Metabox. &#x20;
* The retrieving hierarchy:
  * First, it will look for data stored within the block
  * If not, it returns the value saved on other related sources such as page or template&#x20;

Example:

<pre class="language-php"><code class="lang-php">&#x3C;?php
<strong>// for ACF
</strong><strong>if (function_exists('gb_get_field')) {
</strong><strong>  $value = gb_get_field('acf_my_value');
</strong><strong>}
</strong>// for Metabox
if (function_exists('gb_get_field')) {
  $value = gb_get_field('mb_bricks_template_my_value');
}
</code></pre>

#### get\_gutenbricks\_meta($key, $post\_id, $args)

**$key (required):** key value that you would use inside Bricks builder to retrieve the dynamic data. You will need `acf_` and `mb_bricks_template_` prefixes for them

**$post\_id (optional)**:  Post, page or CPT where you want to retrieve the data from

**$args (optional):** $arg parameter for Metabox's rwmb\_get\_value(). Ignored when the dynamic data is from ACF.
