Title: Delete Failed Logins &#8211; Multisite
Last modified: August 17, 2019

---

# Delete Failed Logins – Multisite

 *  Resolved [jkdev](https://wordpress.org/support/users/jkdev/)
 * (@jkdev)
 * [6 years, 9 months ago](https://wordpress.org/support/topic/delete-failed-logins-multisite/)
 * Hello,
 * Thanks you for the great plugin! I have a question I’m hoping you can help with..
 * I have a multisite network, and wondering if there is a way to “Delete All Failed
   Login Records” from all the sites on the network at once, without having to go
   into each subsite. Just to be clear, I’m talking about the button under WP Security
   > User Login > Failed Login Records Tab. Hoping for a way to purge those for 
   all subsites from one spot on the primary site, or network admin. Maybe a cron
   job, anything that could get it done really.
 * I’m okay with adding some code to the functions.php if needed.
 * Thank you
    -  This topic was modified 6 years, 9 months ago by [jkdev](https://wordpress.org/support/users/jkdev/).

Viewing 9 replies - 1 through 9 (of 9 total)

 *  Plugin Contributor [mbrsolution](https://wordpress.org/support/users/mbrsolution/)
 * (@mbrsolution)
 * [6 years, 9 months ago](https://wordpress.org/support/topic/delete-failed-logins-multisite/#post-11841890)
 * Hi, thank you for reaching out to us. I have submitted a message to the developers
   to investigate further your request.
 * Kind regards
 *  Thread Starter [jkdev](https://wordpress.org/support/users/jkdev/)
 * (@jkdev)
 * [6 years, 8 months ago](https://wordpress.org/support/topic/delete-failed-logins-multisite/#post-11955073)
 * [@mbrsolution](https://wordpress.org/support/users/mbrsolution/) Hello, just 
   checking in on this. Thank you.
 *  Plugin Contributor [wpsolutions](https://wordpress.org/support/users/wpsolutions/)
 * (@wpsolutions)
 * [6 years, 8 months ago](https://wordpress.org/support/topic/delete-failed-logins-multisite/#post-11969636)
 * Hi [@jkdev](https://wordpress.org/support/users/jkdev/),
 * > “Delete All Failed Login Records” from all the sites on the network at once
 * Short answer is no there isn’t.
    But there is a filter hook which controls how
   many rows are kept in the aiowps_failed_logins table. You could add some code
   in your functions.php file and set the number of rows to 0. The filter is defined
   inside the wp_security-backup.php file as follows: `$max_rows_failed_logins_table
   = apply_filters( 'aiowps_max_rows_failed_logins_table', $max_rows_failed_logins_table);`
 * So you could hook into the above filter from your functions.php and return a 
   value of 0 for the $max_rows_failed_logins_table.
    Your table rows will then 
   get deleted when the aiowps hourly cron task eventually fires.
 * ps: you could speed up the process and network deactivate and reactivate the 
   aiowps plugin and then visit each of your subsite home pages to trigger the cleanup
   task.
    After you’ve cleaned up the tables you might want to comment out the code
   from your functions.php file if you don’t want that table to be continually emptied.
 *  Thread Starter [jkdev](https://wordpress.org/support/users/jkdev/)
 * (@jkdev)
 * [6 years, 8 months ago](https://wordpress.org/support/topic/delete-failed-logins-multisite/#post-11973431)
 * [@wpsolutions](https://wordpress.org/support/users/wpsolutions/) Hello, thank
   you for the info. I tried to do this, and couldn’t get the hook to work. Do you
   think it would be possible for you to give me exactly what I need to add into
   the functions.php file?
 *  Thread Starter [jkdev](https://wordpress.org/support/users/jkdev/)
 * (@jkdev)
 * [6 years, 8 months ago](https://wordpress.org/support/topic/delete-failed-logins-multisite/#post-11976470)
 * Looks like I got it working. This is what I added to my functions.php. Does this
   look correct?
 *     ```
       function clear_security_failed_login() {
   
               $failed_logins_table_name = AIOWPSEC_TBL_FAILED_LOGINS;
               $max_rows_failed_logins_table = '10'; //Keep a max of 5000 rows in the events table
               $max_rows_failed_logins_table = apply_filters( 'aiowps_max_rows_failed_logins_table', $max_rows_failed_logins_table );
               AIOWPSecurity_Utility::cleanup_table($failed_logins_table_name, $max_rows_failed_logins_table);
   
       }
   
       add_action('aiowps_perform_db_cleanup_tasks', 'clear_security_failed_login');
       ```
   
    -  This reply was modified 6 years, 8 months ago by [jkdev](https://wordpress.org/support/users/jkdev/).
 *  Plugin Contributor [wpsolutions](https://wordpress.org/support/users/wpsolutions/)
 * (@wpsolutions)
 * [6 years, 8 months ago](https://wordpress.org/support/topic/delete-failed-logins-multisite/#post-11979482)
 * Hi [@jkdev](https://wordpress.org/support/users/jkdev/),
    It’s not quite right
   in the sense that you are not hooking into the “filter” I mentioned earlier, 
   but you are hooking into an action hook. So I guess it is an alternative way 
   to clear out that table.
 * However I recommend that you use the filter I mentioned earlier.
    You will need
   to use the “add_filter” function because you are hooking into a filter not an
   action hook. Here’s an example which will clear all rows except 5:
 *     ```
       add_filter('aiowps_max_rows_failed_logins_table', 'modify_max_rows_failed_logins', 10, 1);
       function modify_max_rows_failed_logins($max_rows) {
       	return 5;
       }
       ```
   
 *  Plugin Contributor [mbrsolution](https://wordpress.org/support/users/mbrsolution/)
 * (@mbrsolution)
 * [6 years, 8 months ago](https://wordpress.org/support/topic/delete-failed-logins-multisite/#post-11996154)
 * [@jkdev](https://wordpress.org/support/users/jkdev/), did the solution provided
   by wpsolutions helped you in any way?
 * Thank you
 *  Thread Starter [jkdev](https://wordpress.org/support/users/jkdev/)
 * (@jkdev)
 * [6 years, 8 months ago](https://wordpress.org/support/topic/delete-failed-logins-multisite/#post-11998264)
 * [@wpsolutions](https://wordpress.org/support/users/wpsolutions/) [@mbrsolution](https://wordpress.org/support/users/mbrsolution/)
   I was just able to test it out and it works perfectly. Much better than what 
   I had. Thanks for the help!!!
 *  Plugin Contributor [mbrsolution](https://wordpress.org/support/users/mbrsolution/)
 * (@mbrsolution)
 * [6 years, 8 months ago](https://wordpress.org/support/topic/delete-failed-logins-multisite/#post-11999850)
 * I am happy to know 🙂
 * Enjoy the plugin.

Viewing 9 replies - 1 through 9 (of 9 total)

The topic ‘Delete Failed Logins – Multisite’ is closed to new replies.

 * ![](https://ps.w.org/all-in-one-wp-security-and-firewall/assets/icon-256x256.
   png?rev=2798307)
 * [All-In-One Security (AIOS) – Security and Firewall](https://wordpress.org/plugins/all-in-one-wp-security-and-firewall/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/all-in-one-wp-security-and-firewall/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/all-in-one-wp-security-and-firewall/)
 * [Active Topics](https://wordpress.org/support/plugin/all-in-one-wp-security-and-firewall/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/all-in-one-wp-security-and-firewall/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/all-in-one-wp-security-and-firewall/reviews/)

 * 9 replies
 * 3 participants
 * Last reply from: [mbrsolution](https://wordpress.org/support/users/mbrsolution/)
 * Last activity: [6 years, 8 months ago](https://wordpress.org/support/topic/delete-failed-logins-multisite/#post-11999850)
 * Status: resolved