wp-settings.php 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545
  1. <?php
  2. /**
  3. * Used to set up and fix common variables and include
  4. * the WordPress procedural and class library.
  5. *
  6. * Allows for some configuration in wp-config.php (see default-constants.php)
  7. *
  8. * @package WordPress
  9. */
  10. /**
  11. * Stores the location of the WordPress directory of functions, classes, and core content.
  12. *
  13. * @since 1.0.0
  14. */
  15. define( 'WPINC', 'wp-includes' );
  16. /*
  17. * These can't be directly globalized in version.php. When updating,
  18. * we're including version.php from another installation and don't want
  19. * these values to be overridden if already set.
  20. */
  21. global $wp_version, $wp_db_version, $tinymce_version, $required_php_version, $required_mysql_version, $wp_local_package;
  22. require( ABSPATH . WPINC . '/version.php' );
  23. require( ABSPATH . WPINC . '/load.php' );
  24. // Check for the required PHP version and for the MySQL extension or a database drop-in.
  25. wp_check_php_mysql_versions();
  26. // Include files required for initialization.
  27. require( ABSPATH . WPINC . '/class-wp-paused-extensions-storage.php' );
  28. require( ABSPATH . WPINC . '/class-wp-fatal-error-handler.php' );
  29. require( ABSPATH . WPINC . '/class-wp-recovery-mode-cookie-service.php' );
  30. require( ABSPATH . WPINC . '/class-wp-recovery-mode-key-service.php' );
  31. require( ABSPATH . WPINC . '/class-wp-recovery-mode-link-service.php' );
  32. require( ABSPATH . WPINC . '/class-wp-recovery-mode-email-service.php' );
  33. require( ABSPATH . WPINC . '/class-wp-recovery-mode.php' );
  34. require( ABSPATH . WPINC . '/error-protection.php' );
  35. require( ABSPATH . WPINC . '/default-constants.php' );
  36. require_once( ABSPATH . WPINC . '/plugin.php' );
  37. /**
  38. * If not already configured, `$blog_id` will default to 1 in a single site
  39. * configuration. In multisite, it will be overridden by default in ms-settings.php.
  40. *
  41. * @global int $blog_id
  42. * @since 2.0.0
  43. */
  44. global $blog_id;
  45. // Set initial default constants including WP_MEMORY_LIMIT, WP_MAX_MEMORY_LIMIT, WP_DEBUG, SCRIPT_DEBUG, WP_CONTENT_DIR and WP_CACHE.
  46. wp_initial_constants();
  47. // Make sure we register the shutdown handler for fatal errors as soon as possible.
  48. wp_register_fatal_error_handler();
  49. // WordPress calculates offsets from UTC.
  50. date_default_timezone_set( 'UTC' );
  51. // Turn register_globals off.
  52. wp_unregister_GLOBALS();
  53. // Standardize $_SERVER variables across setups.
  54. wp_fix_server_vars();
  55. // Check if we have received a request due to missing favicon.ico
  56. wp_favicon_request();
  57. // Check if we're in maintenance mode.
  58. wp_maintenance();
  59. // Start loading timer.
  60. timer_start();
  61. // Check if we're in WP_DEBUG mode.
  62. wp_debug_mode();
  63. /**
  64. * Filters whether to enable loading of the advanced-cache.php drop-in.
  65. *
  66. * This filter runs before it can be used by plugins. It is designed for non-web
  67. * run-times. If false is returned, advanced-cache.php will never be loaded.
  68. *
  69. * @since 4.6.0
  70. *
  71. * @param bool $enable_advanced_cache Whether to enable loading advanced-cache.php (if present).
  72. * Default true.
  73. */
  74. if ( WP_CACHE && apply_filters( 'enable_loading_advanced_cache_dropin', true ) && file_exists( WP_CONTENT_DIR . '/advanced-cache.php' ) ) {
  75. // For an advanced caching plugin to use. Uses a static drop-in because you would only want one.
  76. include( WP_CONTENT_DIR . '/advanced-cache.php' );
  77. // Re-initialize any hooks added manually by advanced-cache.php
  78. if ( $wp_filter ) {
  79. $wp_filter = WP_Hook::build_preinitialized_hooks( $wp_filter );
  80. }
  81. }
  82. // Define WP_LANG_DIR if not set.
  83. wp_set_lang_dir();
  84. // Load early WordPress files.
  85. require( ABSPATH . WPINC . '/compat.php' );
  86. require( ABSPATH . WPINC . '/class-wp-list-util.php' );
  87. require( ABSPATH . WPINC . '/formatting.php' );
  88. require( ABSPATH . WPINC . '/meta.php' );
  89. require( ABSPATH . WPINC . '/functions.php' );
  90. require( ABSPATH . WPINC . '/class-wp-meta-query.php' );
  91. require( ABSPATH . WPINC . '/class-wp-matchesmapregex.php' );
  92. require( ABSPATH . WPINC . '/class-wp.php' );
  93. require( ABSPATH . WPINC . '/class-wp-error.php' );
  94. require( ABSPATH . WPINC . '/pomo/mo.php' );
  95. // Include the wpdb class and, if present, a db.php database drop-in.
  96. global $wpdb;
  97. require_wp_db();
  98. // Set the database table prefix and the format specifiers for database table columns.
  99. $GLOBALS['table_prefix'] = $table_prefix;
  100. wp_set_wpdb_vars();
  101. // Start the WordPress object cache, or an external object cache if the drop-in is present.
  102. wp_start_object_cache();
  103. // Attach the default filters.
  104. require( ABSPATH . WPINC . '/default-filters.php' );
  105. // Initialize multisite if enabled.
  106. if ( is_multisite() ) {
  107. require( ABSPATH . WPINC . '/class-wp-site-query.php' );
  108. require( ABSPATH . WPINC . '/class-wp-network-query.php' );
  109. require( ABSPATH . WPINC . '/ms-blogs.php' );
  110. require( ABSPATH . WPINC . '/ms-settings.php' );
  111. } elseif ( ! defined( 'MULTISITE' ) ) {
  112. define( 'MULTISITE', false );
  113. }
  114. register_shutdown_function( 'shutdown_action_hook' );
  115. // Stop most of WordPress from being loaded if we just want the basics.
  116. if ( SHORTINIT ) {
  117. return false;
  118. }
  119. // Load the L10n library.
  120. require_once( ABSPATH . WPINC . '/l10n.php' );
  121. require_once( ABSPATH . WPINC . '/class-wp-locale.php' );
  122. require_once( ABSPATH . WPINC . '/class-wp-locale-switcher.php' );
  123. // Run the installer if WordPress is not installed.
  124. wp_not_installed();
  125. // Load most of WordPress.
  126. require( ABSPATH . WPINC . '/class-wp-walker.php' );
  127. require( ABSPATH . WPINC . '/class-wp-ajax-response.php' );
  128. require( ABSPATH . WPINC . '/capabilities.php' );
  129. require( ABSPATH . WPINC . '/class-wp-roles.php' );
  130. require( ABSPATH . WPINC . '/class-wp-role.php' );
  131. require( ABSPATH . WPINC . '/class-wp-user.php' );
  132. require( ABSPATH . WPINC . '/class-wp-query.php' );
  133. require( ABSPATH . WPINC . '/query.php' );
  134. require( ABSPATH . WPINC . '/class-wp-date-query.php' );
  135. require( ABSPATH . WPINC . '/theme.php' );
  136. require( ABSPATH . WPINC . '/class-wp-theme.php' );
  137. require( ABSPATH . WPINC . '/template.php' );
  138. require( ABSPATH . WPINC . '/class-wp-user-request.php' );
  139. require( ABSPATH . WPINC . '/user.php' );
  140. require( ABSPATH . WPINC . '/class-wp-user-query.php' );
  141. require( ABSPATH . WPINC . '/class-wp-session-tokens.php' );
  142. require( ABSPATH . WPINC . '/class-wp-user-meta-session-tokens.php' );
  143. require( ABSPATH . WPINC . '/class-wp-metadata-lazyloader.php' );
  144. require( ABSPATH . WPINC . '/general-template.php' );
  145. require( ABSPATH . WPINC . '/link-template.php' );
  146. require( ABSPATH . WPINC . '/author-template.php' );
  147. require( ABSPATH . WPINC . '/post.php' );
  148. require( ABSPATH . WPINC . '/class-walker-page.php' );
  149. require( ABSPATH . WPINC . '/class-walker-page-dropdown.php' );
  150. require( ABSPATH . WPINC . '/class-wp-post-type.php' );
  151. require( ABSPATH . WPINC . '/class-wp-post.php' );
  152. require( ABSPATH . WPINC . '/post-template.php' );
  153. require( ABSPATH . WPINC . '/revision.php' );
  154. require( ABSPATH . WPINC . '/post-formats.php' );
  155. require( ABSPATH . WPINC . '/post-thumbnail-template.php' );
  156. require( ABSPATH . WPINC . '/category.php' );
  157. require( ABSPATH . WPINC . '/class-walker-category.php' );
  158. require( ABSPATH . WPINC . '/class-walker-category-dropdown.php' );
  159. require( ABSPATH . WPINC . '/category-template.php' );
  160. require( ABSPATH . WPINC . '/comment.php' );
  161. require( ABSPATH . WPINC . '/class-wp-comment.php' );
  162. require( ABSPATH . WPINC . '/class-wp-comment-query.php' );
  163. require( ABSPATH . WPINC . '/class-walker-comment.php' );
  164. require( ABSPATH . WPINC . '/comment-template.php' );
  165. require( ABSPATH . WPINC . '/rewrite.php' );
  166. require( ABSPATH . WPINC . '/class-wp-rewrite.php' );
  167. require( ABSPATH . WPINC . '/feed.php' );
  168. require( ABSPATH . WPINC . '/bookmark.php' );
  169. require( ABSPATH . WPINC . '/bookmark-template.php' );
  170. require( ABSPATH . WPINC . '/kses.php' );
  171. require( ABSPATH . WPINC . '/cron.php' );
  172. require( ABSPATH . WPINC . '/deprecated.php' );
  173. require( ABSPATH . WPINC . '/script-loader.php' );
  174. require( ABSPATH . WPINC . '/taxonomy.php' );
  175. require( ABSPATH . WPINC . '/class-wp-taxonomy.php' );
  176. require( ABSPATH . WPINC . '/class-wp-term.php' );
  177. require( ABSPATH . WPINC . '/class-wp-term-query.php' );
  178. require( ABSPATH . WPINC . '/class-wp-tax-query.php' );
  179. require( ABSPATH . WPINC . '/update.php' );
  180. require( ABSPATH . WPINC . '/canonical.php' );
  181. require( ABSPATH . WPINC . '/shortcodes.php' );
  182. require( ABSPATH . WPINC . '/embed.php' );
  183. require( ABSPATH . WPINC . '/class-wp-embed.php' );
  184. require( ABSPATH . WPINC . '/class-wp-oembed.php' );
  185. require( ABSPATH . WPINC . '/class-wp-oembed-controller.php' );
  186. require( ABSPATH . WPINC . '/media.php' );
  187. require( ABSPATH . WPINC . '/http.php' );
  188. require( ABSPATH . WPINC . '/class-http.php' );
  189. require( ABSPATH . WPINC . '/class-wp-http-streams.php' );
  190. require( ABSPATH . WPINC . '/class-wp-http-curl.php' );
  191. require( ABSPATH . WPINC . '/class-wp-http-proxy.php' );
  192. require( ABSPATH . WPINC . '/class-wp-http-cookie.php' );
  193. require( ABSPATH . WPINC . '/class-wp-http-encoding.php' );
  194. require( ABSPATH . WPINC . '/class-wp-http-response.php' );
  195. require( ABSPATH . WPINC . '/class-wp-http-requests-response.php' );
  196. require( ABSPATH . WPINC . '/class-wp-http-requests-hooks.php' );
  197. require( ABSPATH . WPINC . '/widgets.php' );
  198. require( ABSPATH . WPINC . '/class-wp-widget.php' );
  199. require( ABSPATH . WPINC . '/class-wp-widget-factory.php' );
  200. require( ABSPATH . WPINC . '/nav-menu.php' );
  201. require( ABSPATH . WPINC . '/nav-menu-template.php' );
  202. require( ABSPATH . WPINC . '/admin-bar.php' );
  203. require( ABSPATH . WPINC . '/rest-api.php' );
  204. require( ABSPATH . WPINC . '/rest-api/class-wp-rest-server.php' );
  205. require( ABSPATH . WPINC . '/rest-api/class-wp-rest-response.php' );
  206. require( ABSPATH . WPINC . '/rest-api/class-wp-rest-request.php' );
  207. require( ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-controller.php' );
  208. require( ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-posts-controller.php' );
  209. require( ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-attachments-controller.php' );
  210. require( ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-post-types-controller.php' );
  211. require( ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-post-statuses-controller.php' );
  212. require( ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-revisions-controller.php' );
  213. require( ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-autosaves-controller.php' );
  214. require( ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-taxonomies-controller.php' );
  215. require( ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-terms-controller.php' );
  216. require( ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-users-controller.php' );
  217. require( ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-comments-controller.php' );
  218. require( ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-search-controller.php' );
  219. require( ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-blocks-controller.php' );
  220. require( ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-block-renderer-controller.php' );
  221. require( ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-settings-controller.php' );
  222. require( ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-themes-controller.php' );
  223. require( ABSPATH . WPINC . '/rest-api/fields/class-wp-rest-meta-fields.php' );
  224. require( ABSPATH . WPINC . '/rest-api/fields/class-wp-rest-comment-meta-fields.php' );
  225. require( ABSPATH . WPINC . '/rest-api/fields/class-wp-rest-post-meta-fields.php' );
  226. require( ABSPATH . WPINC . '/rest-api/fields/class-wp-rest-term-meta-fields.php' );
  227. require( ABSPATH . WPINC . '/rest-api/fields/class-wp-rest-user-meta-fields.php' );
  228. require( ABSPATH . WPINC . '/rest-api/search/class-wp-rest-search-handler.php' );
  229. require( ABSPATH . WPINC . '/rest-api/search/class-wp-rest-post-search-handler.php' );
  230. require( ABSPATH . WPINC . '/class-wp-block-type.php' );
  231. require( ABSPATH . WPINC . '/class-wp-block-styles-registry.php' );
  232. require( ABSPATH . WPINC . '/class-wp-block-type-registry.php' );
  233. require( ABSPATH . WPINC . '/class-wp-block-parser.php' );
  234. require( ABSPATH . WPINC . '/blocks.php' );
  235. require( ABSPATH . WPINC . '/blocks/archives.php' );
  236. require( ABSPATH . WPINC . '/blocks/block.php' );
  237. require( ABSPATH . WPINC . '/blocks/calendar.php' );
  238. require( ABSPATH . WPINC . '/blocks/categories.php' );
  239. require( ABSPATH . WPINC . '/blocks/latest-comments.php' );
  240. require( ABSPATH . WPINC . '/blocks/latest-posts.php' );
  241. require( ABSPATH . WPINC . '/blocks/rss.php' );
  242. require( ABSPATH . WPINC . '/blocks/search.php' );
  243. require( ABSPATH . WPINC . '/blocks/shortcode.php' );
  244. require( ABSPATH . WPINC . '/blocks/tag-cloud.php' );
  245. $GLOBALS['wp_embed'] = new WP_Embed();
  246. // Load multisite-specific files.
  247. if ( is_multisite() ) {
  248. require( ABSPATH . WPINC . '/ms-functions.php' );
  249. require( ABSPATH . WPINC . '/ms-default-filters.php' );
  250. require( ABSPATH . WPINC . '/ms-deprecated.php' );
  251. }
  252. // Define constants that rely on the API to obtain the default value.
  253. // Define must-use plugin directory constants, which may be overridden in the sunrise.php drop-in.
  254. wp_plugin_directory_constants();
  255. $GLOBALS['wp_plugin_paths'] = array();
  256. // Load must-use plugins.
  257. foreach ( wp_get_mu_plugins() as $mu_plugin ) {
  258. include_once( $mu_plugin );
  259. /**
  260. * Fires once a single must-use plugin has loaded.
  261. *
  262. * @since 5.1.0
  263. *
  264. * @param string $mu_plugin Full path to the plugin's main file.
  265. */
  266. do_action( 'mu_plugin_loaded', $mu_plugin );
  267. }
  268. unset( $mu_plugin );
  269. // Load network activated plugins.
  270. if ( is_multisite() ) {
  271. foreach ( wp_get_active_network_plugins() as $network_plugin ) {
  272. wp_register_plugin_realpath( $network_plugin );
  273. include_once( $network_plugin );
  274. /**
  275. * Fires once a single network-activated plugin has loaded.
  276. *
  277. * @since 5.1.0
  278. *
  279. * @param string $network_plugin Full path to the plugin's main file.
  280. */
  281. do_action( 'network_plugin_loaded', $network_plugin );
  282. }
  283. unset( $network_plugin );
  284. }
  285. /**
  286. * Fires once all must-use and network-activated plugins have loaded.
  287. *
  288. * @since 2.8.0
  289. */
  290. do_action( 'muplugins_loaded' );
  291. if ( is_multisite() ) {
  292. ms_cookie_constants();
  293. }
  294. // Define constants after multisite is loaded.
  295. wp_cookie_constants();
  296. // Define and enforce our SSL constants
  297. wp_ssl_constants();
  298. // Create common globals.
  299. require( ABSPATH . WPINC . '/vars.php' );
  300. // Make taxonomies and posts available to plugins and themes.
  301. // @plugin authors: warning: these get registered again on the init hook.
  302. create_initial_taxonomies();
  303. create_initial_post_types();
  304. wp_start_scraping_edited_file_errors();
  305. // Register the default theme directory root
  306. register_theme_directory( get_theme_root() );
  307. if ( ! is_multisite() ) {
  308. // Handle users requesting a recovery mode link and initiating recovery mode.
  309. wp_recovery_mode()->initialize();
  310. }
  311. // Load active plugins.
  312. foreach ( wp_get_active_and_valid_plugins() as $plugin ) {
  313. wp_register_plugin_realpath( $plugin );
  314. include_once( $plugin );
  315. /**
  316. * Fires once a single activated plugin has loaded.
  317. *
  318. * @since 5.1.0
  319. *
  320. * @param string $plugin Full path to the plugin's main file.
  321. */
  322. do_action( 'plugin_loaded', $plugin );
  323. }
  324. unset( $plugin );
  325. // Load pluggable functions.
  326. require( ABSPATH . WPINC . '/pluggable.php' );
  327. require( ABSPATH . WPINC . '/pluggable-deprecated.php' );
  328. // Set internal encoding.
  329. wp_set_internal_encoding();
  330. // Run wp_cache_postload() if object cache is enabled and the function exists.
  331. if ( WP_CACHE && function_exists( 'wp_cache_postload' ) ) {
  332. wp_cache_postload();
  333. }
  334. /**
  335. * Fires once activated plugins have loaded.
  336. *
  337. * Pluggable functions are also available at this point in the loading order.
  338. *
  339. * @since 1.5.0
  340. */
  341. do_action( 'plugins_loaded' );
  342. // Define constants which affect functionality if not already defined.
  343. wp_functionality_constants();
  344. // Add magic quotes and set up $_REQUEST ( $_GET + $_POST )
  345. wp_magic_quotes();
  346. /**
  347. * Fires when comment cookies are sanitized.
  348. *
  349. * @since 2.0.11
  350. */
  351. do_action( 'sanitize_comment_cookies' );
  352. /**
  353. * WordPress Query object
  354. *
  355. * @global WP_Query $wp_the_query WordPress Query object.
  356. * @since 2.0.0
  357. */
  358. $GLOBALS['wp_the_query'] = new WP_Query();
  359. /**
  360. * Holds the reference to @see $wp_the_query
  361. * Use this global for WordPress queries
  362. *
  363. * @global WP_Query $wp_query WordPress Query object.
  364. * @since 1.5.0
  365. */
  366. $GLOBALS['wp_query'] = $GLOBALS['wp_the_query'];
  367. /**
  368. * Holds the WordPress Rewrite object for creating pretty URLs
  369. *
  370. * @global WP_Rewrite $wp_rewrite WordPress rewrite component.
  371. * @since 1.5.0
  372. */
  373. $GLOBALS['wp_rewrite'] = new WP_Rewrite();
  374. /**
  375. * WordPress Object
  376. *
  377. * @global WP $wp Current WordPress environment instance.
  378. * @since 2.0.0
  379. */
  380. $GLOBALS['wp'] = new WP();
  381. /**
  382. * WordPress Widget Factory Object
  383. *
  384. * @global WP_Widget_Factory $wp_widget_factory
  385. * @since 2.8.0
  386. */
  387. $GLOBALS['wp_widget_factory'] = new WP_Widget_Factory();
  388. /**
  389. * WordPress User Roles
  390. *
  391. * @global WP_Roles $wp_roles WordPress role management object.
  392. * @since 2.0.0
  393. */
  394. $GLOBALS['wp_roles'] = new WP_Roles();
  395. /**
  396. * Fires before the theme is loaded.
  397. *
  398. * @since 2.6.0
  399. */
  400. do_action( 'setup_theme' );
  401. // Define the template related constants.
  402. wp_templating_constants();
  403. // Load the default text localization domain.
  404. load_default_textdomain();
  405. $locale = get_locale();
  406. $locale_file = WP_LANG_DIR . "/$locale.php";
  407. if ( ( 0 === validate_file( $locale ) ) && is_readable( $locale_file ) ) {
  408. require( $locale_file );
  409. }
  410. unset( $locale_file );
  411. /**
  412. * WordPress Locale object for loading locale domain date and various strings.
  413. *
  414. * @global WP_Locale $wp_locale WordPress date and time locale object.
  415. * @since 2.1.0
  416. */
  417. $GLOBALS['wp_locale'] = new WP_Locale();
  418. /**
  419. * WordPress Locale Switcher object for switching locales.
  420. *
  421. * @since 4.7.0
  422. *
  423. * @global WP_Locale_Switcher $wp_locale_switcher WordPress locale switcher object.
  424. */
  425. $GLOBALS['wp_locale_switcher'] = new WP_Locale_Switcher();
  426. $GLOBALS['wp_locale_switcher']->init();
  427. // Load the functions for the active theme, for both parent and child theme if applicable.
  428. foreach ( wp_get_active_and_valid_themes() as $theme ) {
  429. if ( file_exists( $theme . '/functions.php' ) ) {
  430. include $theme . '/functions.php';
  431. }
  432. }
  433. unset( $theme );
  434. /**
  435. * Fires after the theme is loaded.
  436. *
  437. * @since 3.0.0
  438. */
  439. do_action( 'after_setup_theme' );
  440. // Set up current user.
  441. $GLOBALS['wp']->init();
  442. /**
  443. * Fires after WordPress has finished loading but before any headers are sent.
  444. *
  445. * Most of WP is loaded at this stage, and the user is authenticated. WP continues
  446. * to load on the {@see 'init'} hook that follows (e.g. widgets), and many plugins instantiate
  447. * themselves on it for all sorts of reasons (e.g. they need a user, a taxonomy, etc.).
  448. *
  449. * If you wish to plug an action once WP is loaded, use the {@see 'wp_loaded'} hook below.
  450. *
  451. * @since 1.5.0
  452. */
  453. do_action( 'init' );
  454. // Check site status
  455. if ( is_multisite() ) {
  456. $file = ms_site_check();
  457. if ( true !== $file ) {
  458. require( $file );
  459. die();
  460. }
  461. unset( $file );
  462. }
  463. /**
  464. * This hook is fired once WP, all plugins, and the theme are fully loaded and instantiated.
  465. *
  466. * Ajax requests should use wp-admin/admin-ajax.php. admin-ajax.php can handle requests for
  467. * users not logged in.
  468. *
  469. * @link https://codex.wordpress.org/AJAX_in_Plugins
  470. *
  471. * @since 3.0.0
  472. */
  473. do_action( 'wp_loaded' );