我正在wordpress安装中使用联系人表单7。我需要以某种方式在联系人表单隐藏字段中传递一个带有当前页面url的隐藏字段。我尝试了他们的自定义函数,并尝试了简短的代码,没有运气。
wpcf7_add_shortcode(\'sourceurl\', \'wpcf7_sourceurl_shortcode_handler\', true);
function wpcf7_sourceurl_shortcode_handler($tag) {
if (!is_array($tag)) return \'\';
$name = $tag[\'name\'];
if (empty($name)) return \'\';
$html = \'<input type="hidden" name="\' . $name . \'" value="http://\' . $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"] . \'" />\';
return $html;
}
在form edition中我尝试了[sourceurl thesource]