Hi @mizagorn,
Is it possible to post a custom field value to a WPUF form?
Thank you for reaching out to us with your inquiry about posting a custom field value to a WPUF form. We understand that you would like to use a URL query argument to set the default value of a dropdown custom field named “title” in the form.
Currently, the direct functionality you described is not built into WP User Frontend. However, there are alternative solutions available to achieve your desired outcome.
One option is to utilize the power of hooks and filters provided by WP User Frontend. By leveraging these hooks and filters, you can customize the behavior of the plugin and implement the functionality you’re looking for.
Here’s a general approach using hooks and filters to set the default value of the “title” dropdown custom field based on a URL query argument:
function set_default_title_value($fields) {
if (isset($_GET['title'])) {
$title_value = sanitize_text_field($_GET['title']);
// Assuming the "title" field is present in the $fields array
$fields['title']['value'] = $title_value;
}
return $fields;
}
add_filter('wpuf_frontend_form_fields', 'set_default_title_value');
Hope this will help. If you have further queries, kindly contact through the website.
Regards!
Thanks very much, Saiful Islam! That was very helpful.
Hi @mizagorn,
You’re most welcome. Now, I’m going to mark this topic as resolved. If you have any queries in the future, you can create another thread.
Have a good day 🙂