Title: Field loaded when placed into variable
Last modified: November 26, 2018

---

# Field loaded when placed into variable

 *  Resolved [RubenZuidervaart](https://wordpress.org/support/users/rubenfonteyn/)
 * (@rubenfonteyn)
 * [7 years, 6 months ago](https://wordpress.org/support/topic/field-loaded-when-placed-into-variable/)
 * Hello,
 * I’ve just installed this extension, and despite it working well there’s a little
   bug when you’re loading the field into a variable.
    Because instead of placing
   the field into a variable, the field gets displayed immediately.
 * It doesn’t matter if the field is inside a group or anything, as soon as it’s
   called it just forces itself onto the front-end.
 * For example:
    Here I’m just preparing a few values to be thrown into the content,
   with a default fallback. The “cta_form_block” is a group, and has the form in
   it. As soon as the group is stored into the variable it’s forcing the form to
   be displayed.
 *     ```
       //Get the page content
       $page_form_content = get_field('cta_form_block'); //Here it's already being displayed
   
           //Setup new empty fields
           $form_title         = '';
           $form_description   = '';
           $form_form          = '';
   
           //Fill the content
           if( $page_form_content ): //Enter group
   
               $form_title         = $page_form_content['title'];
               $form_description   = $page_form_content['description'];
               $form_form          = $page_form_content['form'];
   
           else:
   
               $form_title         = $default_title;
               $form_description   = $default_description;
               $form_form          = $default_form;
   
           endif;
   
       ?>
       ```
   
 * I then figured I might try to make it it’s own field, so I gave it it’s own field.
   Like so:
    `$page_form_form = get_field('cta_form_form');`
 * That’ll also immediately display the form.
 * So now I’ll just call the field directly in the content, while I’m generally 
   trying to keep the logic and content seperated as much as possible.
 * It’s not a dramatic issue, but I thought that it’d be good for you guys to know
   about this.

Viewing 1 replies (of 1 total)

 *  Plugin Author [KrishaWeb](https://wordpress.org/support/users/krishaweb/)
 * (@krishaweb)
 * [7 years, 6 months ago](https://wordpress.org/support/topic/field-loaded-when-placed-into-variable/#post-10940336)
 * Hello [@rubenfonteyn](https://wordpress.org/support/users/rubenfonteyn/)
 * Thank you for your idea.
 * we have implemented it by giving a filter. Please check the updated version of
   the plugin and try with it. Let us know whether it worked or not.
 * Thank you

Viewing 1 replies (of 1 total)

The topic ‘Field loaded when placed into variable’ is closed to new replies.

 * ![](https://ps.w.org/acf-field-for-contact-form-7/assets/icon-256x256.png?rev
   =3488610)
 * [ACF Field For CF7](https://wordpress.org/plugins/acf-field-for-contact-form-7/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/acf-field-for-contact-form-7/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/acf-field-for-contact-form-7/)
 * [Active Topics](https://wordpress.org/support/plugin/acf-field-for-contact-form-7/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/acf-field-for-contact-form-7/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/acf-field-for-contact-form-7/reviews/)

## Tags

 * [filter](https://wordpress.org/support/topic-tag/filter/)
 * [shortcode](https://wordpress.org/support/topic-tag/shortcode/)

 * 1 reply
 * 2 participants
 * Last reply from: [KrishaWeb](https://wordpress.org/support/users/krishaweb/)
 * Last activity: [7 years, 6 months ago](https://wordpress.org/support/topic/field-loaded-when-placed-into-variable/#post-10940336)
 * Status: resolved