WordPress source code explanation (2)

Source: Internet
Author: User
Tags set cookie

Map: index. php-> ...... -> Wp-config.php-> wp-setting.php

 

Wp-settings.php:
Description: Used to set public variables and load WP programs and class libraries (where WP functions, classes, and core content are stored ). You do not need to modify this file, but you can configure it by modifying the wp-config.php file.
1) define wpinc constants and introduce the wpinc/load. php, wpinc/default-constants.php, wpinc/version. php files required for initialization.
2) Call the wp_initial_constants () function to initialize the constant wp_memory_limit, wp_debug, wp_content_dir, and wp_cache. 3) Close the magic reference at runtime, And the magic reference will be added later via wpdb in the wp-settings.php.
4) set the default time zone of PhP5.
5) Call the wp_unregister_globals () function to disable register_globals.
6) unset global variables $ wp_filter, $ cache_lastcommentmodified, $ cache_lastpostdate to ensure they do not exist.
7) Normalize $ _ server variable settings.
8) Check the required PHP version and MySQL extension or database drop-in.
9) check whether a request is received because favicon. ICO is missing.
10) check whether it is in maintenance mode.
11) Enable the loading timer.
12) check whether it is in wp_debug mode.
13) determine whether to load and how to load WP_CONTENT_DIR/advanced-cache.php files based on the WP_CACHE and WP_DEBUG constants.
14) Call the wp_set_lang_dir () function to set the constant WP_LANG_DIR.
15) Load WPINC/compat. php, WPINC/functions. php, WPINC/classes. php.
16) Call the require_wp_db () function to introduce the wpdb class or database drop-in db. php (if any ).
17) Call the wp_set_wpdb_vars () function to set the database table prefix and format specifier of the database table column.
18) Call the wp_start_object_cache () function to enable the WP object cache or extend the object cache (if the corresponding drop-in exists ).
19) load the WP file WPINC/plugin. php, WPINC/default-filters.php, WPINC/pomo/mo. php.
20) If multi-site is enabled, load the file WPINC/ms-blogs.php, WPINC/ms-settings.php; otherwise, set the constant MULTISITE to false.
---- If you only need the basic function (that is, the SHORTINIT constant is true), The wp-setting.php file will return when it is executed here! ----
21) load the l18n library WPINC/l10n. php.
22) Call the wp_not_installed () function. If WP is not installed, start the installer.
23) load the * Big Head (most of WP) * of WP )*:
WPINC/formatting. php,
WPINC/capabilities. php,
WPINC/query. php,
WPINC/theme. php,
WPINC/user. php,
WPINC/meta. php,
WPINC/general-template.php,
WPINC/link-template.php,
WPINC/author-template.php,
WPINC/post. php,
WPINC/post-template.php,
WPINC/category. php,
WPINC/category-template.php,
WPINC/comment. php,
WPINC/comment-template.php,
WPINC/rewrite. php,
WPINC/feed. php,
WPINC/bookmark. php,
WPINC/bookmark-template.php,
WPINC/kses. php,
WPINC/cron. php,
WPIN/deprecated. php,
WPINC/script-loader.php,
WPINC/taxonomy. php,
WPINC/update. php,
WPINC/canonical. php,
WPINC/javascodes. php,
WPINC/media. php,
WPINC/http. php,
WPINC/class-http.php,
WPINC/widgets. php,
WPINC/nav-menu.php,
WPINC/nav-menu-template.php
24) Load multiple site-specific files, WPINC/ms-functions.php, WPINC/ms-default-filters.php, WPINC/ms-deprecated.php.
25) Call the wp_plugin_directory_constants () function to define a constant that depends on the API to obtain the default value. Define a required plug-in folder constant, which may be overwritten in sunrise. php drop-in.
26) use the wp_get_mu_plugins () function to load the required plug-in and trigger the mount point do_action ('muplugins _ loaded ');
27) Call the ms_cookie_constants () function to set cookie constants for multiple sites.
28) Call the wp_cookie_constants () function to define constants after loading multiple sites. cookie-related constants may be overwritten in ms_network_cookies.
29) Call the wp_ssl_constants () function to define and execute SSL constants.
30) load the WPINC/vars. php file to create a public global variable.
31) Call the create_initial_taxonomies () and create_initial_post_types () functions to make the classification and articles visible to the plug-in and topic. The plug-in author should note that these will be re-registered during hook initialization.
32) use the wp_get_active_and_valid_plugins () function to load the activated plug-in.
33) the function of loading pluggable, WPINC/pluggable. php, WPINC/pluggable-deprecated.php.
34) Call the wp_set_internal_encoding () function to set the internal encoding.
35) If WP_CACHE is enabled and the wp_cache_postload () function exists, this function is called.
36) trigger the mount point do_action ('ins INS _ loaded ').
37) Call the wp_functionality_constants () function to define constants that have not been defined but will affect the function.
38) Call the wp_magic_quotes () function to add a magic reference and assemble $ _ REQUEST ($ _ GET + $ _ POST ).
39) trigger the mount point do_action ('sanitize _ comment_cookies ') (harmless comment cookie ).
40) create a global WP query object $ wp_the_query = & new WP_Query () and save the $ wp_the_query reference to $ wp_query and use $ wp_query for query.
41) create a WP override object $ wp_rewrite = & new WP_Rewrite () to create a beautiful URLs.
42) create a WP object $ wp = & new WP ().
43) Create the WP Widget factory object $ wp_widget_factory = & new WP_Widget_Factory ().
44) trigger the mount point do_action ('setup _ theme ').
45) Call the wp_templating_constants () function to set template-related constants.
46) Call the load_default_textdomain () function to load the default text localization domain.
47) locate the blog region settings $ locale = get_locale ().
48) after loading the text field, load the local data WPINC/locale. php.
49) create a localized object $ wp_locale = & new WP_Locale () to load local domain data and various strings.
50) load the function library TEMPLATEPATH/functions. php for the activated topic.
51) trigger the mount point do_action ('after _ setup_theme ').
52) Call the require_if_theme_supports () function to load all functions supported by the topic.
53) Register and close the register_shutdown_function ('shutdown _ action_hook ').
54) Create the current user $ wp-> init ().
55) trigger the mount point do_action ('init '). At this stage, most of WP has been loaded and authenticated. WP will continue to load the installers on the init hook, such as widgets and various plug-in instances. If you want to insert an action after WP loading, use the following wp_loaded hook.
56) if it is a multi-site, check the Site status.
57) trigger the mount point do_action ('wp _ loaded '). When wp, all plug-ins, and themes are fully loaded and instantiated, the hook is removed. Ajax requests should use the wp-admin/admin-ajax.php that can process requests from Unlogged users.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.