Support » Fixing WordPress » Block Spamming Websites

  • Resolved seoglobalexpert



    Can anyone help me to know how can I block some websites on my WP blog?

    As few webmasters are posting 100 of same comments on my blog, so is there any way that I can block them?

    Kindly advice.



Viewing 6 replies - 1 through 6 (of 6 total)
  • Well, an effective measure would be blocking the IP from which they are leaving all those comments. Each comment has associated with it an IP address, and you can copy/paste that into this function, and then put this function into your themes functions.php file.

    $allowed_ips = array(COMMA SEPARATED LIST OF IP's i.e. '', 123.12.321.12');
    if(!in_array($ip, $allowed_ips)) wp_die('Are you a spammer? Then no soup for you!');

    Some people will complain that an IP blacklist is overkill, and you’ll block people that you don’t mean to, but this is just a quick example. Maybe I’ll throw together a plugin.

    Are they manually submitted or automated comments? Have you tried Akismet?

    Thanks for your replies, I haven’t tried Akismet, I guess one person can not submit same comment on all may pages (entire blog posts) those are automated I guess.

    Let me try with blocking IP, I hope it works.


    Thanks a lot!

    Dear Easel

    While I copied the code you posted and uploaded the file the page was showing error

    Parse error: syntax error, unexpected T_STRING, expecting ‘)’ in /home/content/s/g/e/sgexpert/html/blog/wp-content/themes/seotheme/functions.php on line 17

    Any help!

    Were you able to figure this out @seoglobalexpert?

    Yes, it helped!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Block Spamming Websites’ is closed to new replies.