How to get WordPress’ version from the CLI

Have you ever been in that situation where you have CLI access to a wordpress site but not through the GUI? I had that experience recently and wanted to know which version of wordpress the person was using. Mainly, I wanted to see if they were keeping things up to date.

So with this handy one liner I found scouring through the web, you can do exactly that.

# find . -name 'version.php' -path '*wp-includes/*' -print -exec grep '$wp_version =' {} \; -exec echo '' \;
$wp_version = '4.1.1';
Matt Patterson avatar
About Matt Patterson
Husband, Father of 3, Programmer at heart, spends his days running ridiculously large data centers in the midwest.