Category Archives: wordpress

WordPress – analysis wp_admin_css(‘install’,true);

as we know css is key role for web page,

wordpress using wp_admin_css(‘install’, true); to print link css.
in format of <link href=’…/xxx.css’>

the most important statement.

1
$tag = apply_filters( 'style_loader_tag', "<link rel='$rel' id='$handle-css' $title href='$href' type='text/css' media='$media' />\n", $handle, $href, $media);

“<link rel=’$rel’ id=’$handle-css’ $title href=’$href’ type=’text/css’ media=’$media’ />\n” will be replaced
to be ‘<link rel=’stylesheet’ id=’install-css’ href=’http://localhost:8082/wordpress2/wp-admin/css/install.min.css?ver=4.7.2′ type=’text/css’ media=’all’ />

Let’s look at what define of apply_filters, “apply_filters($tag,$value)”. ‘style_loader_tag’ has nothing in global variable $wp_filter.

Therefore, apply_filters do nothing here, it only return second param as string to print.

1
2
3
4
echo $conditional_pre;
echo $tag;
$this->print_inline_style( $handle );
echo $conditional_post;

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.