Last active
July 6, 2019 12:55
-
-
Save sergeliatko/fda78b5316b34ad279a98245136df0f1 to your computer and use it in GitHub Desktop.
Moves the Google reCAPTCHA notice after all fields before the submit button in WordPress comment form.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Move Google reCAPTCHA after the comment form fields and before the submit button. | |
*/ | |
add_action( 'init', function () { | |
if ( | |
has_action( 'comment_form_logged_in_after', 'gglcptch_commentform_display' ) | |
|| has_action( 'comment_form_after_fields', 'gglcptch_commentform_display' ) | |
) { | |
remove_action( 'comment_form_logged_in_after', 'gglcptch_commentform_display' ); | |
remove_action( 'comment_form_after_fields', 'gglcptch_commentform_display' ); | |
add_filter( 'comment_form_submit_field', function ( $submit_field ) { | |
ob_start(); | |
gglcptch_commentform_display(); | |
return ob_get_clean() . $submit_field; | |
}, 0, 1 ); | |
} | |
}, 50, 0 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment