Find outdated versions of WordPress on your Cpanel or Plesk server

The outdated versions of WordPress causes many security issues on the server. In order to prevent this issue at some level, it is necessary to keep your WordPress updated. Hacked WordPress sites will not only be a problem for the client who has hacked, but also an issue for all clients on the server, as the hacker used to send out spam from the hacked account.

If you have a server with number of sites running on it, it is difficult to find out accounts which are using outdated WordPress. The below scripts helps you to find outdated versions of WordPress on your server.

cPanel Server:

Find outdated versions of WordPress:

find /home/*/public_html/ -type f -iwholename “*/wp-includes/version.php” -exec grep -H “\$wp_version =” {} \;

Plesk Server:

Find outdated versions of WordPress: 

find /var/www/vhosts/*/httpdocs/ -type f -iwholename “*/wp-includes/version.php” -exec grep -H 
“\$wp_version =” {} \;

The output will look like this..

/home/username1/public_html/wp-includes/version.php:$wp_version = ‘4.1’;
/home/username2/public_html/wp-includes/version.php:$wp_version = ‘3.2.1’;
/home/username3/public_html/wordpress2/wp-includes/version.php:$wp_version = ‘3.5.1’;

This will show the WordPress installation folder , as well as the running version.

Windows/IIS (default path) with Powershell:

Get-ChildItem -Path “C:\inetpub\wwwroot\” -Filter “version.php” -Recurse | Select-String -pattern 
“\`$wp_version =”

That’s it!

Leave a Reply

Your email address will not be published. Required fields are marked *