Add Invisible recaptcha to an form
-
The suggestion to add to any form did not work for my custom form.
do_action(‘google_invre_render_widget_action’);// Validate form post request
$is_valid = apply_filters(‘google_invre_is_valid_request_filter’, true);
if( ! $is_valid )
{
// handle error here
}
else
{
// continue with your logic
}Firstly, the form did not render visibly so as to check the box. Then, obviously, i i think, validation failed in my hook (backend processor).
My form Script
<form id=”nasnifeuploadform” action=”” method=”post” enctype=”multipart/form-data”>
<legend>Upload additional images and files</legend>
<legend></legend>
<input id=”post_id” hidden type=”text” name=”post_id” width=”100%”
value=”<?php echo esc_html(get_the_ID())?>”>
<table align=”left” border=”2px solid black” cellspacing=”0″ cellpadding=”0″ width=”75%”>
<tr align=”left” valign=”top”>
<td>
<?php// do_action(‘google_invre_render_widget_action’);
?>
</td>
</tr>
<tr align=”left” valign=”top”>
<td>
<input id=”filestoupload” type=”file” name=”filestoupload[]” multiple=”true” required>
<input id=”process” type=”submit” name =”process” value=”Upload”>
</td>
</tr>
<tr align=”left” valign=”top”>
<td>
<input type=”hidden” name=”action” value=”submit_nasni_frontend_files_mi”>
<?php wp_nonce_field( ‘nasni_fef_upload’, ‘ns_feform_nonce_field’ ); ?>
</td>
</tr>
</table>
<i class=”fa fa-arrow-up”>Click Choose files; Select the files; Click UPLOAD</i>
</form>// Code snippet in form handle
// Verify Recaptcha
$recaptcha_is_valid = apply_filters(‘google_invre_is_valid_request_filter’, true);
if( ! $recaptcha_is_valid ){
// die(‘Recaptcha Verification failed’);
}admin_ajax is used.
- The topic ‘Add Invisible recaptcha to an form’ is closed to new replies.