• Resolved Mizagorn

    (@mizagorn)


    Is it possible to post a custom field value to a WPUF form?

    In other words, say I have a dropdown custom field with a name of “title” in the form. I would like to be able to use a URL with an included query argument ‘?title=”New Year”‘ and then the “title” dropdown custom field selects that value as the default.

    I searched the documentation and could not find anything like that.

    As an alternative, are there any hooks or filters available that might handle this functionality?

    Seems like this would be a really awesome feature to have!

    • This topic was modified 1 year, 8 months ago by Mizagorn. Reason: removed duplicate word "the"
Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support Saiful Islam

    (@saifislam01)

    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!

    Thread Starter Mizagorn

    (@mizagorn)

    Thanks very much, Saiful Islam! That was very helpful.

    Plugin Support Saiful Islam

    (@saifislam01)

    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 ??

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Pass value to custom field using query arguments’ is closed to new replies.