Search code examples
mysqlwordpressversion

Check WordPress Version in a MySQL database


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?


Solution

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

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

    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:

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

    See https://codex.wordpress.org/WordPress_Versions for a cross reference of db_version (database version) to WordPress release.

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

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