Step 2. Edit wp-content/plugins/wp-ban/wp-ban.php
- Open wp-content/plugins/wp-ban/wp-ban.php for editing using your favorite text editor.
- Somewhere after the following line
add_action('init', 'ban_textdomain');add the following function definition.
### Function: Process Banned Bad URL ### http://www.microshell.com/website_internet/security/updating-wp-ban-to-include-bad-urls function process_ban_bad_url($banned_bad_urls, $against) { // We should never ban wp-admin. if(!empty($banned_bad_urls) && !preg_match('/^\/wp-admin/', $against)) { foreach($banned_bad_urls as $banned_bad_url) { // Let's never ban wp-admin URLs. if (strstr($against, $banned_bad_url) !== false) { print_banned_message(); break; } } } } - Find the function definition for banned() and add the following PHP line near the variable definitions.
$banned_bad_urls = get_option('banned_bad_urls'); - Under the same banned() function definition, under the following block:
if (!$is_excluded)
add the following line:
process_ban_bad_url($banned_bad_urls, $_SERVER['REQUEST_URI']);
- Find the function definition for ban_init() and add the following lines. I recommend adding them on the appropriate section within the function. However, if you add them anywhere in the function, it should be fine.
// http://www.microshell.com/website_internet/security/updating-wp-ban-to-include-bad-urls $banned_bad_urls = array(); add_option('banned_bad_urls', $banned_bad_urls, 'Banned Bad URLs'); - That’s about it. If you have any problems, then revert back to the original installation of wp-ban. You’re welcome to contact me. I hope I can help you debug the problem.
There you have it guys. I hope this article helps your blogging experience better. Please leave comments / suggestions / questions if you have. I’m looking forward to improving my solution with your comments / suggestions / questions.







AWESOME!! Thanks for the work. I\’ve been getting nailed by some Koreans constantly trying the SERVER[DOCUMENT_ROOT] over and over again. Even though I\’ve banned them by IP, WP-Ban isn\’t banning them. Hopefully this will take care of them. If not, I\’ll just have to htaccess them.
Kewl
Glad you like it …