Compatibility with Jetpack’s Contact Form in a widget
-
Hi Mike, I’ve used your plugin to add a CAPTCHA to Jetpack’s Contact Form and it works just fine when the
[contact_form]
shortcode is embedded inthe_content
but fails when the[contact_form]
shortcode is placed in a text widget.FYI, the solution is to filter
widget_text
with the following (which I placed directly after line 193 in ‘si-captcha.php’):add_filter( 'widget_text', array($this, 'si_captcha_jetpack_form'), 0);
In addition, it is necessary to force shortcodes to be parsed in text widgets:
add_filter( 'widget_text', 'shortcode_unautop' ); add_filter( 'widget_text', 'do_shortcode' );
If you think this is too complicated for most of your users, you might wish to implement a version of what Jetpack does specifically for your shortcode when users have opted to enable CAPTCHA on Jetpack Contact Forms:
https://github.com/Automattic/jetpack/blob/master/modules/contact-form/grunion-contact-form.php#L444
Thanks for a neat plugin!
Cheers, Christian
- The topic ‘Compatibility with Jetpack’s Contact Form in a widget’ is closed to new replies.