Given that I can't access the dashboard/admin pages on my blog (that's a future question), and that I have shell access to my hosting server, can I find out the current version of WordPress from the command line?

I tried grepping for the string '@since' in all the php files in the top level directory for the blog, and the latest I can see is 2.5...

  • Perhaps someone with enough reputation could re-tag this question? Thanks.
    – dr-jan
    Commented Sep 2, 2010 at 10:55

6 Answers 6


Just run this grep command from the command line:

grep wp_version wp-includes/version.php

I use this command to find all installs of WordPress on my VPS server

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

Its a really quick way to find out which accounts are out of date.


You can also just go to http://example.com/readme.html in a web browser The readme file ships with every version of WordPress and displays the installed version number prominently at the top of the page.

Also, if you can view your site’s front-end (I know you said you can't access the dashboard, so I’m just assuming your blog is public), you can “view source” to see the installed version number. There’s a meta tag called generator that displays the current WordPress version:

<meta name="generator" content="WordPress 3.0.1" />

No need to use grep at all.


I just want to add the batch version of this script, as I've spent quite a bit of time till I found this:

Use it to print all the versions of all your wordpress install within a folder.

find . -name 'version.php' -path '*wp-includes/*' -print -exec grep '$wp_version =' {} \; -exec echo '' \;

Please use the below command to check the current wordpress version:

# grep wp_version wp-includes/version.php

Output sample:

root@vps [/home/dedu/public_html]# grep wp_version wp-includes/version.php
 * @global string $wp_version
$wp_version = '4.4.2';

If you want to use that information for something in a script, you can do this:

VERSION=$(grep "wp_version =" wp-includes/version.php | awk '{print $3}' | sed "s/'//g" | sed "s/;//g")

That would leave in $VERSION variable, only the number of the wp version.

Not the answer you're looking for? Browse other questions tagged or ask your own question.