Support » Plugin: Comment Reply Email Notification » GDPR check client side

  • Plugin Author Arno Welzel


    It would be nice, if the GDPR checkobox would also be checked client side using JavaScript. Then visitors would not be that confused when they just see a blank page with an error message by WordPress.

    The way I do this in my custom GDPR extension (the checkbox is named wp-comment-privacy-consent in my case and the submit button of a comment form is named submit):

    function my_privacy_comment_javascript(){
        if (!is_user_logged_in() && is_single() && comments_open()){
    <script type="text/javascript">
    jQuery(document).ready(function($) {
    	$("#submit").click(function(e) {
    		if(!$('#wp-comment-privacy-consent').prop('checked')) {
    			alert('<?php echo __('You must agree to the privacy policy to submit a comment.', 'my_textdomain'); ?>');
    			return false;

    See in action here:

  • You must be logged in to reply to this topic.