Snippets / PHP
PHP
Pull in Email Field into Fluent Forms (FREE)
D
Donald McGuinn
·
302 views
·
Updated 1 year ago
This snippet will allow you to pull in an email from an email field in the custom post type fields to send the contact form to that email instead of an author email.
/*
* Use default value in the editor as
* {embed_post_custom_field}
* Then it will show the embedded post's custom field value
*/
add_filter('fluentform_editor_shortcode_callback_embed_post_custom_field', function ($code) {
$post_id = get_the_ID(); // Get the current post ID
$custom_field_value = get_post_meta($post_id, 'email', true); // Replace 'your_custom_field_key' with your actual custom field key
return $custom_field_value;
});
PHP · 10 lines
Discussion 1
Ask a question or share how you used this.
Log in
to join the discussion.
rrvoigt
1 year ago
We did a test of the script and it pulls the email address and shows it on the form screen. Just like the screenshots above. But when submitting the Fluent form the email goes to the 'Administration Email Address ' under 'Settings > General'. We also use FluentSMTP, any additional steps?
Donald McGuinn
1 year ago
Make sure you're using an email field, then in the email settings, pull the email in from a field like so.