[resolved] Block Spamming Websites (7 posts)

  1. seoglobalexpert
    Posted 4 years ago #


    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.



  2. Electric Easel
    Posted 4 years ago #

    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.

  3. Khang Minh
    Posted 4 years ago #

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

  4. seoglobalexpert
    Posted 4 years ago #

    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!

  5. seoglobalexpert
    Posted 4 years ago #

    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!

  6. Donald Gilbert
    Posted 4 years ago #

    Were you able to figure this out @seoglobalexpert?

  7. seoglobalexpert
    Posted 4 years ago #

    Yes, it helped!

Topic Closed

This topic has been closed to new replies.

About this Topic