30 Mar

WordPress: getting summary from Login Security Solution plugin

Brute-force attacks are one the most common ones against WordPress sites. One of the possible solution is to use Login Security Solution plugin. It tracks attempts to login and ban IPs if there are too many of them during certain period of time. The plugin stores all information about the attempts in wp_login_security_solution_fail table. Here is how you can get summary on IP addresses which are attacking your site:

select ip, count(ip) as attempts from wp_login_security_solution_fail group by ip order by attempts desc;

Now you can block the most active of them in the firewall.

13 Mar

How to hide readme.html from WordPress setup under nginx

By default Worpdress places readme.hml file to your webroot directory, so it’s possible to get it. The problem is this file contains your WordPress version. So if for some reason you have vulnerable version of WordPress you might want to hide this file. This is how you can implement this:

location = /readme.html
{
return 404;
}

Keep in mind that it will not remove your WordPress version from your feeds and HTML headers.

28 Feb

How to get number of registered users in WordPress databases (if you have a lot of databases)

Task

There are a lot of WordPress based websites (as well as not WordPress) databases on your box.  It’s necessary to get  number of registered users in WordPress databases only.

Solution

Collecting WordPress databases:

mysql -Bse " use information_schema; select TABLE_SCHEMA from TABLES where table_name like 'wp_users';" > wp_users.txt

Getting the numbers:

for i in $(cat wp_users.txt ) ; do echo -n $i " "; mysql -Bse "use $i ; select count(id) from wp_users " ; echo ; done | sort -rnk2 | less
25 Feb

Why WordPress is great

  1. It’s the most popular blogging CMS nowadays.
  2. WordPress is easy to install (minutes), maintain (automatic updates feature from the box) and use (just give it a try).
  3. It’s has thousands of useful plugins for almost all requirement you might need.
  4. It also has really a lot of themes (both free of charge and commercial).
  5. It’s famous for its helpful community.
  6. You can host your WordPress blog for free on wordpress.com.
  7. You don’t need to have special skills to share you knowledges.
10 Feb

How to change ‘Home’ link text in WordPress

If you need to change you ‘Home’ link text in your WordPress installation just put these lines to your theme’s function.php:

function change_home($menu_text) {
return preg_replace('/>Home</', '>Blog<', $menu_text, 1);
}
add_filter('wp_page_menu','change_home');

Change ‘Blog’ to whatever you need. The solution was found here.