Capturing Form Page URL

January 4th, 2016

Situation: you have a form defined and it appears on more than one page. You wish to capture the page URL in the form submission.

Using the Shortcodes Actions and Filters plugin, create a filter like the following.
 
Change ‘url’ to whatever name you would like the field to be

1
2
3
4
5
function set_cf7_page_url($formData) {
    $formData->posted_data['url'] = $_SERVER['HTTP_REFERER'];
    return $formData;
}
add_filter('cfdb_form_data', 'set_cf7_page_url');
Comments are closed.  Go To Support Forum