{"id":1337,"date":"2015-09-03T13:57:19","date_gmt":"2015-09-03T17:57:19","guid":{"rendered":"http:\/\/cfdbplugin.com\/?page_id=1337"},"modified":"2016-01-04T21:20:43","modified_gmt":"2016-01-05T02:20:43","slug":"capturing-form-page-url","status":"publish","type":"page","link":"https:\/\/cfdbplugin.com\/?page_id=1337","title":{"rendered":"Capturing Form Page URL"},"content":{"rendered":"<p><strong>Situation<\/strong>: you have a form defined and it appears on more than one page. You wish to capture the page URL in the form submission.<\/p>\n<p>Using the <a href=\"https:\/\/wordpress.org\/plugins\/add-actions-and-filters\/\" target=\"_blank\">Shortcodes Actions and Filters<\/a> plugin, create a filter like the following.<br \/>\n&nbsp;<br \/>\nChange &#8216;url&#8217; to whatever name you would like the field to be<\/p>\n<pre lang=\"php\" line=\"1\" escaped=\"true\">function set_cf7_page_url($formData) {\r\n    $formData->posted_data['url'] = $_SERVER['HTTP_REFERER'];\r\n    return $formData;\r\n}\r\nadd_filter('cfdb_form_data', 'set_cf7_page_url');<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>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. &nbsp; Change &#8216;url&#8217; to whatever name you would like the field to be function set_cf7_page_url($formData) { $formData->posted_data[&#8216;url&#8217;] [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":102,"menu_order":6,"comment_status":"closed","ping_status":"closed","template":"","meta":{"jetpack_post_was_ever_published":false,"footnotes":""},"class_list":["post-1337","page","type-page","status-publish","hentry"],"jetpack_shortlink":"https:\/\/wp.me\/P1mptf-lz","jetpack_sharing_enabled":true,"jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/cfdbplugin.com\/index.php?rest_route=\/wp\/v2\/pages\/1337","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cfdbplugin.com\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/cfdbplugin.com\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/cfdbplugin.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/cfdbplugin.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1337"}],"version-history":[{"count":2,"href":"https:\/\/cfdbplugin.com\/index.php?rest_route=\/wp\/v2\/pages\/1337\/revisions"}],"predecessor-version":[{"id":1355,"href":"https:\/\/cfdbplugin.com\/index.php?rest_route=\/wp\/v2\/pages\/1337\/revisions\/1355"}],"up":[{"embeddable":true,"href":"https:\/\/cfdbplugin.com\/index.php?rest_route=\/wp\/v2\/pages\/102"}],"wp:attachment":[{"href":"https:\/\/cfdbplugin.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1337"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}