GitHub
Jim Valentine
@f13dev
f13dev
Margate, UK
f13.dev
Joined March 28, 2016
Margate, UK
f13.dev
Joined March 28, 2016
Sorry, that page does not exist
Coders Rank
Add Google reCaptcha to comments forms on posts and pages. Additional filters are included for programmers to add reCaptcha to forms with ease.
As a site owner or developer it is frustrating having to store multiple coppies of the same API keys, for example if you were to have seperate reCaptcha plugins for comments and contact forms. For this reason hooks have been included allowing integration with F13 reCaptcha from other plugins.
To add a Google reCaptcha checkbox via filters can be achieved simply.
$v = '<form>'; // Form fields $v .= apply_filters('f13_recaptcha_add'); $v .= '<input type="submit" value="Submit">'; $v .= '</form>'; return $v;
Using the above code as an example, a Google reCaptcha checkbox will now be shown on the form. If you are unable to see the reCaptcha, it may be due to the visibility setting in the admin panel, try setting this to “Everybody”.
Similar to adding a reCaptcha checkbox, validation is achieved via a filter. The validation filter returns:
$msg = ''; $recaptcha = apply_filters('f13_recaptcha_validate'); if (!empty($recaptcha)) { // reCaptcha has failed, show an error message $msg = $recaptcha; } else { // reCaptcha has passed // Continue validation of other fields $msg = 'Success'; } return $msg;
In order for F13 reCaptcha to operate, a google reCaptcha V2 Checkbox API key is required.
To obtain a Google reCaptcha API key:
Google reCaptcha can be enabled for:
Installing is as simple as 1,2,3 –