WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Block Spamming Websites (7 posts)

  1. seoglobalexpert
    Member
    Posted 3 years ago #

    Hi,

    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.

    Regards

    Candy

  2. Electric Easel
    Member
    Posted 3 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.123.12', 123.12.321.12');
    
    $ip=$_SERVER['REMOTE_ADDR'];
    
    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
    Member
    Posted 3 years ago #

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

  4. seoglobalexpert
    Member
    Posted 3 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
    Member
    Posted 3 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
    Member
    Posted 3 years ago #

    Were you able to figure this out @seoglobalexpert?

  7. seoglobalexpert
    Member
    Posted 3 years ago #

    Yes, it helped!

Topic Closed

This topic has been closed to new replies.

About this Topic