Waseem Abbas
Waseem Abbas

Reputation: 11

Custom Field is not working in Contact Form 7 in ver 4.1.1

There was a situation where i had to create a custom hidden field in Contact Form 7 which captures page url. I used following code to achieve it.

add_action( 'wpcf7_init', 'wpcf7_add_shortcode_sourceurl' );
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;
}

It was working fine till i upgraded my Contact Form 7 to version 4.1.1

Any body can help to so that i can acheive the same in latest version of Contact Form 7 4.1.1 or 4.1.2.

Thank you,

~Waseem~

I

Upvotes: 1

Views: 994

Answers (1)

Manoj Dhiman
Manoj Dhiman

Reputation: 5166

try to upload this plugin wpcf7 field extend

Upvotes: 1

Related Questions