Monthly Archives: February 2017

WordPress – Database Scheme

when installing wordpress,
using salt

https://api.wordpress.org/secret-key/1.1/salt/

to get random string text as ID of website.

in scheme.php whose path is (wp-admin/includes/schema.php)

$blog_tables has table name, scheme, and all information wp need.

Step By Step.
1. After clicking on ‘Installing wordpress’, dbDelta(‘all’) will call wp_get_db_schema(‘all’) in schema.php to get all sql script.

1
2
3
4
5
6
7
8
9
10
11
function dbDelta( $queries = '', $execute = true ) {
..	if ( in_array( $queries, array( '', 'all', 'blog', 'global', 'ms_global' ), true ) )
	    $queries = wp_get_db_schema( $queries );
..
}
 
function wp_install( $blog_title, $user_name, $user_email, $public, $deprecated = '', $user_password = '', $language = '' ) {
...
	make_db_current_silent(); // here we go to dbDelta
...
}

in scheme.php:
function populate_options()

wordpress will load default theme which defined in WP_DEFAULT_THEME.