Created
October 5, 2023 08:46
-
-
Save mehrshaddarzi/481a23ad6f1d016b6d8e90c3c0c80ce6 to your computer and use it in GitHub Desktop.
Disable English Comment Name in WordPress
This file contains 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
<?php | |
/* | |
* Plugin Name: Disable Comment Post | |
*/ | |
add_action( 'pre_comment_on_post', function($comment_post_id) { | |
if(preg_match("/[a-z]/i", $_POST['author'])){ | |
wp_die("نام خود را به فارسی وارد نمایید"); | |
} | |
} ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment