admin管理员组文章数量:1130349
I've added the following code to my function file to add the recaptcha, however I do not know how I can validate the captcha.
/**
* Add Captcha to Comments Form
*/
add_filter('comment_form', function() {
echo '<div class="g-recaptcha" data-sitekey="'.GOOGLE_RECAPTCHA_SITEKEY.'"></div>';
});
Is there a filter for the submission of the comments form? I will be validating the captcha server side using the following:
Any advise on how to implement the captcha to the comments form would be appreciated.
I've added the following code to my function file to add the recaptcha, however I do not know how I can validate the captcha.
/**
* Add Captcha to Comments Form
*/
add_filter('comment_form', function() {
echo '<div class="g-recaptcha" data-sitekey="'.GOOGLE_RECAPTCHA_SITEKEY.'"></div>';
});
Is there a filter for the submission of the comments form? I will be validating the captcha server side using the following:
https://github/google/recaptcha
Any advise on how to implement the captcha to the comments form would be appreciated.
Share Improve this question edited Dec 5, 2018 at 13:59 Johansson 15.4k11 gold badges44 silver badges80 bronze badges asked Dec 5, 2018 at 13:17 lkylky 2812 silver badges8 bronze badges1 Answer
Reset to default 0There's a preprocess_comment filter that is run before the comment is inserted in the database.
You will have access to the comment's data:
add_filter( 'preprocess_comment' , 'wpse321083_process_recaptcha' );
function wpse321083_process_recaptcha( $commentdata ) {
// Process recaptcha here
return $commentdata;
}
Here's also a good article on SitePoint explaining how to implement this feature in your website.
I've added the following code to my function file to add the recaptcha, however I do not know how I can validate the captcha.
/**
* Add Captcha to Comments Form
*/
add_filter('comment_form', function() {
echo '<div class="g-recaptcha" data-sitekey="'.GOOGLE_RECAPTCHA_SITEKEY.'"></div>';
});
Is there a filter for the submission of the comments form? I will be validating the captcha server side using the following:
Any advise on how to implement the captcha to the comments form would be appreciated.
I've added the following code to my function file to add the recaptcha, however I do not know how I can validate the captcha.
/**
* Add Captcha to Comments Form
*/
add_filter('comment_form', function() {
echo '<div class="g-recaptcha" data-sitekey="'.GOOGLE_RECAPTCHA_SITEKEY.'"></div>';
});
Is there a filter for the submission of the comments form? I will be validating the captcha server side using the following:
https://github/google/recaptcha
Any advise on how to implement the captcha to the comments form would be appreciated.
Share Improve this question edited Dec 5, 2018 at 13:59 Johansson 15.4k11 gold badges44 silver badges80 bronze badges asked Dec 5, 2018 at 13:17 lkylky 2812 silver badges8 bronze badges1 Answer
Reset to default 0There's a preprocess_comment filter that is run before the comment is inserted in the database.
You will have access to the comment's data:
add_filter( 'preprocess_comment' , 'wpse321083_process_recaptcha' );
function wpse321083_process_recaptcha( $commentdata ) {
// Process recaptcha here
return $commentdata;
}
Here's also a good article on SitePoint explaining how to implement this feature in your website.
本文标签: filtersHow to validate recaptcha on comments form
版权声明:本文标题:filters - How to validate recaptcha on comments form? 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://it.en369.cn/questions/1749046179a2307864.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。


发表评论