在 mysql 数据库中检查 Wordpress 版本

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/21406655/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 19:55:12  来源:igfitidea点击:

Check Wordpress Version in a mysql database

mysqlwordpressversion

提问by user3244602

I'm a wordpress designer & developer and I want to know if if it's possible to check my wordpress version in tables of mysql database to print it in an administration panel page ?

我是一名 wordpress 设计师和开发人员,我想知道是否可以在 mysql 数据库表中检查我的 wordpress 版本以将其打印在管理面板页面中?

回答by Halaster

Should be in wp_options table, the field is called db_version. So, yes, it's possible.

应该在 wp_options 表中,该字段称为 db_version。所以,是的,这是可能的。

You can run this SQL command (substitute your table name if different):

您可以运行此 SQL 命令(如果不同,请替换您的表名):

SELECT * FROM `wp_options` where option_name = 'db_version'

Make sure to consult the codex, as the db_version looks different from the wp version. for instance:

请务必查阅 codex,因为 db_version 看起来与 wp 版本不同。例如:

For Version 3.1, the database version (db_version in wp_options) changed to 17056, and the Trac revision was 17485.

对于3.1版本,数据库版本(wp_options中的db_version)更改为17056,Trac修订版为17485。

See https://codex.wordpress.org/WordPress_Versionsfor a cross reference of db_version (database version) to Word Press release.

请参阅https://codex.wordpress.org/WordPress_Versions以获取 db_version(数据库版本)与 Word 新闻稿的交叉引用。

Alternatively, you can find the file in the wordpress installation, inside the folder "wp-incudes". The file is called version.phpand defines a global variable like so:

或者,您可以在 wordpress 安装中的“wp-incudes”文件夹中找到该文件。该文件名为version.php并定义了一个全局变量,如下所示:

/**
 * The WordPress version string
 *
 * @global string $wp_version
 */
$wp_version = '3.7.1';