Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Check Wordpress Version in a mysql database

Tags:

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 ?

like image 690
user3244602 Avatar asked Jan 28 '14 13:01

user3244602


People also ask

How do I find the version of WordPress in my database?

The first thing you need to do is to log in to the admin dashboard of your WordPress site. From there, scroll down to the bottom of the page. On that page, you can see your WordPress version number in the admin widget labeled At a Glance.

Does WordPress run on MySQL?

WordPress uses a database management system called MySQL, which is open source software.

How do you check WordPress is installed or not?

php File. The most reliable and accurate way to check your WordPress version is to directly access version. php within your site's files. To do this, your website will need to be live with a web hosting account so you can get your FTP login credentials, or use cPanel to access the internal files.

What version of SQL does WordPress use?

WordPress uses MySQL for its database management system. MySQL is open-source software, and it is responsible for managing the components of a WordPress database such as user data, user meta, posts, comments, and so on. We will discuss it a little bit later.


2 Answers

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 Word Press 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'; 
like image 186
Halaster Avatar answered Nov 03 '22 20:11

Halaster


I'm afraid that the accepted answer to this question is no longer accurate.

You cannot use db_version from wp_options because the db_version does not always change between Wordpress updates (eg. with maintenance releases). I have multiple installations of Wordpress and I have confirmed that the db_version for v5.8 has remained the same in v5.8.1. Additionally, if you look at the reference at http://codex.wordpress.org/WordPress_Versions you will also find that the same DB version numbers are used across multiple releases of Wordpress. Therefore, you are unable to rely on db_version to determine what version of Wordpress you are running.

However, you can query _site_transient_update_core in wp_options and look in the option_value for the version number after "version_checked". For example:

SELECT option_value FROM wp_options WHERE (option_name IN ('_site_transient_update_core')); 

Would produce an output in option_value and I find in there:

s:15:"version_checked";s:5:"5.4.7"; 

My Wordpress version is v5.4.7.

Reference: https://wordpress.org/support/topic/obtaining-wp-version-from-database/ which provides further information on the _site_transient_update_core database option and the reliability of querying it.

like image 23
Alk Avatar answered Nov 03 '22 22:11

Alk