Quantcast
Channel: WordPress.org Forums » [Forminator Forms – Contact Form, Payment Form & Custom Form Builder] Support
Viewing all articles
Browse latest Browse all 1511

PHP for Pulling Dynamic Content from Custom Fields

$
0
0

Replies: 1

First of all, thank you for making Forminator great! Appreciate your help!

How do I put the value of a meta field/custom field into one of the Forminator fields? I’m using Gutenberg. A Forminator form is automatically added to each page of a custom post type I made with Advanced Custom Fields (ACF). I am trying to put some hidden custom field values (corresponding to each individual page) about the project a submission corresponds to in hidden fields of a form, so that the form stays short, accurate, and avoids redundancy.

In a previous support thread, the support team gave a very brief and obscure answer that a meta field could be retrieved using the following PHP code:

$custom_field_value = get_post_meta(get_the_ID(), 'custom_field_name', true);

The answer did not explain where to put this code. I tried putting it in the hidden form field, using the meta key shown in ACF. I tried entering it without PHP tags and with PHP tags, but neither returned the proper value when I did test submissions. I tried some other Forminator form fields too, but none worked.

How do I get this dynamic (relative to the form, static relative to the individual post) content submitted with the form?

  • This topic was modified 6 hours, 29 minutes ago by FAOU.

Viewing all articles
Browse latest Browse all 1511

Trending Articles