我知道已经有了一个公认的答案,但只是把这个扔出去。我这样做的方式是从博客目录的wp includes/version中解析出$wp\\u version变量。php文件:
function get_wp_version() {
 $versionFile = ABS_PATH.\'/wp-includes/version.php\'
 // NO VERSION FILE //
 if (($versionStr = @file_get_contents($versionFile))==\'\') return \'\'; 
 $regex = "wp_version.*\'(?<wpVersion>.*)\'";
 if (preg_match(\'/\'.$regex.\'/\', $versionStr, $matches)) {
  return $matches[\'wpVersion\'];
 }
 return \'\';
}