wordpress学习第五篇(wp-setting.php)

下面我们来学习wp-setting.php的内容

init();

/**
 * Most of WP is loaded at this stage, and the user is authenticated. WP continues
 * to load on the init hook that follows (e.g. widgets), and many plugins instantiate
 * themselves on it for all sorts of reasons (e.g. they need a user, a taxonomy, etc.).
 *
 * If you wish to plug an action once WP is loaded, use the wp_loaded hook below.
 */
do_action( 'init' );

// Check site status
if ( is_multisite() ) {
	if ( true !== ( $file = ms_site_check() ) ) {
		require( $file );
		die();
	}
	unset($file);
}

/**
 * This hook is fired once WP, all plugins, and the theme are fully loaded and instantiated.
 *
 * AJAX requests should use wp-admin/admin-ajax.php. admin-ajax.php can handle requests for
 * users not logged in.
 *
 * @link http://codex.wordpress.org/AJAX_in_Plugins
 *
 * @since 3.0.0
 */
do_action('wp_loaded');
?>

这个文件基本上是用来载入大部分的内容的。

定义WPINC为wp-includes,所以在wordpress的主题或者插件的编写过程中,可以用WPINC这个常量。

然后载入wp-includes/load.php,wp-includes/default-constants.php,wp-includes/version.php文件。

wp_initial_constants( )以及wp_check_php_mysql_versions()在以后的章节中介绍,肯定在wp-includes/load.php,wp-includes/default-constants.php,wp-includes/version.php文件里。

wp_unregister_GLOBALS();下面的几个函数到文件里的时候再介绍。unset( $wp_filter, $cache_lastcommentmodified );wp_fix_server_vars();wp_favicon_request();wp_maintenance();timer_start();wp_debug_mode();wp_set_lang_dir();

WP_CONTENT_DIR . '/advanced-cache.php'缓冲插件的应用

然后载入下面的几个文件:compat.php,functions.php,class-wp.php,class-wp-error.php,plugin.php

require_wp_db(),wp_set_wpdb_vars()以及wp_start_object_cache()函数在后面的章节中介绍。

继续载入default-filters.php以及pomo/mo.php文件。下面的一些代码在以后的章节中在介绍,这个文件基本上把wordpress所有的文件都载入了,所以通过这个文件可以看出加载wordpress需要那么多的文件,包含了很多的函数。应该对性能有一定的影响。





你可能感兴趣的:(wordpress,相关学习)