20 * |
20 * |
21 * These can't be directly globalized in version.php. When updating, |
21 * These can't be directly globalized in version.php. When updating, |
22 * include version.php from another installation and don't override |
22 * include version.php from another installation and don't override |
23 * these values if already set. |
23 * these values if already set. |
24 * |
24 * |
25 * @global string $wp_version The WordPress version string. |
25 * @global string $wp_version The WordPress version string. |
26 * @global int $wp_db_version WordPress database version. |
26 * @global int $wp_db_version WordPress database version. |
27 * @global string $tinymce_version TinyMCE version. |
27 * @global string $tinymce_version TinyMCE version. |
28 * @global string $required_php_version The required PHP version string. |
28 * @global string $required_php_version The required PHP version string. |
29 * @global string $required_mysql_version The required MySQL version string. |
29 * @global string[] $required_php_extensions The names of required PHP extensions. |
30 * @global string $wp_local_package Locale code of the package. |
30 * @global string $required_mysql_version The required MySQL version string. |
31 */ |
31 * @global string $wp_local_package Locale code of the package. |
32 global $wp_version, $wp_db_version, $tinymce_version, $required_php_version, $required_mysql_version, $wp_local_package; |
32 */ |
|
33 global $wp_version, $wp_db_version, $tinymce_version, $required_php_version, $required_php_extensions, $required_mysql_version, $wp_local_package; |
33 require ABSPATH . WPINC . '/version.php'; |
34 require ABSPATH . WPINC . '/version.php'; |
34 require ABSPATH . WPINC . '/compat.php'; |
35 require ABSPATH . WPINC . '/compat.php'; |
35 require ABSPATH . WPINC . '/load.php'; |
36 require ABSPATH . WPINC . '/load.php'; |
36 |
37 |
37 // Check for the required PHP version and for the MySQL extension or a database drop-in. |
38 // Check for the required PHP version and for the MySQL extension or a database drop-in. |
38 wp_check_php_mysql_versions(); |
39 wp_check_php_mysql_versions(); |
39 |
40 |
40 // Include files required for initialization. |
41 // Include files required for initialization. |
41 require ABSPATH . WPINC . '/class-wp-paused-extensions-storage.php'; |
42 require ABSPATH . WPINC . '/class-wp-paused-extensions-storage.php'; |
|
43 require ABSPATH . WPINC . '/class-wp-exception.php'; |
42 require ABSPATH . WPINC . '/class-wp-fatal-error-handler.php'; |
44 require ABSPATH . WPINC . '/class-wp-fatal-error-handler.php'; |
43 require ABSPATH . WPINC . '/class-wp-recovery-mode-cookie-service.php'; |
45 require ABSPATH . WPINC . '/class-wp-recovery-mode-cookie-service.php'; |
44 require ABSPATH . WPINC . '/class-wp-recovery-mode-key-service.php'; |
46 require ABSPATH . WPINC . '/class-wp-recovery-mode-key-service.php'; |
45 require ABSPATH . WPINC . '/class-wp-recovery-mode-link-service.php'; |
47 require ABSPATH . WPINC . '/class-wp-recovery-mode-link-service.php'; |
46 require ABSPATH . WPINC . '/class-wp-recovery-mode-email-service.php'; |
48 require ABSPATH . WPINC . '/class-wp-recovery-mode-email-service.php'; |
190 require ABSPATH . WPINC . '/class-wp-theme-json.php'; |
192 require ABSPATH . WPINC . '/class-wp-theme-json.php'; |
191 require ABSPATH . WPINC . '/class-wp-theme-json-resolver.php'; |
193 require ABSPATH . WPINC . '/class-wp-theme-json-resolver.php'; |
192 require ABSPATH . WPINC . '/class-wp-duotone.php'; |
194 require ABSPATH . WPINC . '/class-wp-duotone.php'; |
193 require ABSPATH . WPINC . '/global-styles-and-settings.php'; |
195 require ABSPATH . WPINC . '/global-styles-and-settings.php'; |
194 require ABSPATH . WPINC . '/class-wp-block-template.php'; |
196 require ABSPATH . WPINC . '/class-wp-block-template.php'; |
|
197 require ABSPATH . WPINC . '/class-wp-block-templates-registry.php'; |
195 require ABSPATH . WPINC . '/block-template-utils.php'; |
198 require ABSPATH . WPINC . '/block-template-utils.php'; |
196 require ABSPATH . WPINC . '/block-template.php'; |
199 require ABSPATH . WPINC . '/block-template.php'; |
197 require ABSPATH . WPINC . '/theme-templates.php'; |
200 require ABSPATH . WPINC . '/theme-templates.php'; |
198 require ABSPATH . WPINC . '/theme-previews.php'; |
201 require ABSPATH . WPINC . '/theme-previews.php'; |
199 require ABSPATH . WPINC . '/template.php'; |
202 require ABSPATH . WPINC . '/template.php'; |
250 require ABSPATH . WPINC . '/media.php'; |
253 require ABSPATH . WPINC . '/media.php'; |
251 require ABSPATH . WPINC . '/http.php'; |
254 require ABSPATH . WPINC . '/http.php'; |
252 require ABSPATH . WPINC . '/html-api/html5-named-character-references.php'; |
255 require ABSPATH . WPINC . '/html-api/html5-named-character-references.php'; |
253 require ABSPATH . WPINC . '/html-api/class-wp-html-attribute-token.php'; |
256 require ABSPATH . WPINC . '/html-api/class-wp-html-attribute-token.php'; |
254 require ABSPATH . WPINC . '/html-api/class-wp-html-span.php'; |
257 require ABSPATH . WPINC . '/html-api/class-wp-html-span.php'; |
|
258 require ABSPATH . WPINC . '/html-api/class-wp-html-doctype-info.php'; |
255 require ABSPATH . WPINC . '/html-api/class-wp-html-text-replacement.php'; |
259 require ABSPATH . WPINC . '/html-api/class-wp-html-text-replacement.php'; |
256 require ABSPATH . WPINC . '/html-api/class-wp-html-decoder.php'; |
260 require ABSPATH . WPINC . '/html-api/class-wp-html-decoder.php'; |
257 require ABSPATH . WPINC . '/html-api/class-wp-html-tag-processor.php'; |
261 require ABSPATH . WPINC . '/html-api/class-wp-html-tag-processor.php'; |
258 require ABSPATH . WPINC . '/html-api/class-wp-html-unsupported-exception.php'; |
262 require ABSPATH . WPINC . '/html-api/class-wp-html-unsupported-exception.php'; |
259 require ABSPATH . WPINC . '/html-api/class-wp-html-active-formatting-elements.php'; |
263 require ABSPATH . WPINC . '/html-api/class-wp-html-active-formatting-elements.php'; |
350 require ABSPATH . WPINC . '/class-wp-block-patterns-registry.php'; |
354 require ABSPATH . WPINC . '/class-wp-block-patterns-registry.php'; |
351 require ABSPATH . WPINC . '/class-wp-block-styles-registry.php'; |
355 require ABSPATH . WPINC . '/class-wp-block-styles-registry.php'; |
352 require ABSPATH . WPINC . '/class-wp-block-type-registry.php'; |
356 require ABSPATH . WPINC . '/class-wp-block-type-registry.php'; |
353 require ABSPATH . WPINC . '/class-wp-block.php'; |
357 require ABSPATH . WPINC . '/class-wp-block.php'; |
354 require ABSPATH . WPINC . '/class-wp-block-list.php'; |
358 require ABSPATH . WPINC . '/class-wp-block-list.php'; |
|
359 require ABSPATH . WPINC . '/class-wp-block-metadata-registry.php'; |
355 require ABSPATH . WPINC . '/class-wp-block-parser-block.php'; |
360 require ABSPATH . WPINC . '/class-wp-block-parser-block.php'; |
356 require ABSPATH . WPINC . '/class-wp-block-parser-frame.php'; |
361 require ABSPATH . WPINC . '/class-wp-block-parser-frame.php'; |
357 require ABSPATH . WPINC . '/class-wp-block-parser.php'; |
362 require ABSPATH . WPINC . '/class-wp-block-parser.php'; |
358 require ABSPATH . WPINC . '/class-wp-classic-to-block-menu-converter.php'; |
363 require ABSPATH . WPINC . '/class-wp-classic-to-block-menu-converter.php'; |
359 require ABSPATH . WPINC . '/class-wp-navigation-fallback.php'; |
364 require ABSPATH . WPINC . '/class-wp-navigation-fallback.php'; |
380 require ABSPATH . WPINC . '/block-supports/dimensions.php'; |
385 require ABSPATH . WPINC . '/block-supports/dimensions.php'; |
381 require ABSPATH . WPINC . '/block-supports/duotone.php'; |
386 require ABSPATH . WPINC . '/block-supports/duotone.php'; |
382 require ABSPATH . WPINC . '/block-supports/shadow.php'; |
387 require ABSPATH . WPINC . '/block-supports/shadow.php'; |
383 require ABSPATH . WPINC . '/block-supports/background.php'; |
388 require ABSPATH . WPINC . '/block-supports/background.php'; |
384 require ABSPATH . WPINC . '/block-supports/block-style-variations.php'; |
389 require ABSPATH . WPINC . '/block-supports/block-style-variations.php'; |
|
390 require ABSPATH . WPINC . '/block-supports/aria-label.php'; |
385 require ABSPATH . WPINC . '/style-engine.php'; |
391 require ABSPATH . WPINC . '/style-engine.php'; |
386 require ABSPATH . WPINC . '/style-engine/class-wp-style-engine.php'; |
392 require ABSPATH . WPINC . '/style-engine/class-wp-style-engine.php'; |
387 require ABSPATH . WPINC . '/style-engine/class-wp-style-engine-css-declarations.php'; |
393 require ABSPATH . WPINC . '/style-engine/class-wp-style-engine-css-declarations.php'; |
388 require ABSPATH . WPINC . '/style-engine/class-wp-style-engine-css-rule.php'; |
394 require ABSPATH . WPINC . '/style-engine/class-wp-style-engine-css-rule.php'; |
389 require ABSPATH . WPINC . '/style-engine/class-wp-style-engine-css-rules-store.php'; |
395 require ABSPATH . WPINC . '/style-engine/class-wp-style-engine-css-rules-store.php'; |
398 require ABSPATH . WPINC . '/script-modules.php'; |
404 require ABSPATH . WPINC . '/script-modules.php'; |
399 require ABSPATH . WPINC . '/interactivity-api/class-wp-interactivity-api.php'; |
405 require ABSPATH . WPINC . '/interactivity-api/class-wp-interactivity-api.php'; |
400 require ABSPATH . WPINC . '/interactivity-api/class-wp-interactivity-api-directives-processor.php'; |
406 require ABSPATH . WPINC . '/interactivity-api/class-wp-interactivity-api-directives-processor.php'; |
401 require ABSPATH . WPINC . '/interactivity-api/interactivity-api.php'; |
407 require ABSPATH . WPINC . '/interactivity-api/interactivity-api.php'; |
402 require ABSPATH . WPINC . '/class-wp-plugin-dependencies.php'; |
408 require ABSPATH . WPINC . '/class-wp-plugin-dependencies.php'; |
|
409 require ABSPATH . WPINC . '/class-wp-url-pattern-prefixer.php'; |
|
410 require ABSPATH . WPINC . '/class-wp-speculation-rules.php'; |
|
411 require ABSPATH . WPINC . '/speculative-loading.php'; |
403 |
412 |
404 add_action( 'after_setup_theme', array( wp_script_modules(), 'add_hooks' ) ); |
413 add_action( 'after_setup_theme', array( wp_script_modules(), 'add_hooks' ) ); |
405 add_action( 'after_setup_theme', array( wp_interactivity(), 'add_hooks' ) ); |
414 add_action( 'after_setup_theme', array( wp_interactivity(), 'add_hooks' ) ); |
406 |
415 |
407 /** |
416 /** |
512 if ( ! is_multisite() && wp_is_fatal_error_handler_enabled() ) { |
521 if ( ! is_multisite() && wp_is_fatal_error_handler_enabled() ) { |
513 // Handle users requesting a recovery mode link and initiating recovery mode. |
522 // Handle users requesting a recovery mode link and initiating recovery mode. |
514 wp_recovery_mode()->initialize(); |
523 wp_recovery_mode()->initialize(); |
515 } |
524 } |
516 |
525 |
|
526 // To make get_plugin_data() available in a way that's compatible with plugins also loading this file, see #62244. |
|
527 require_once ABSPATH . 'wp-admin/includes/plugin.php'; |
|
528 |
517 // Load active plugins. |
529 // Load active plugins. |
518 foreach ( wp_get_active_and_valid_plugins() as $plugin ) { |
530 foreach ( wp_get_active_and_valid_plugins() as $plugin ) { |
519 wp_register_plugin_realpath( $plugin ); |
531 wp_register_plugin_realpath( $plugin ); |
|
532 |
|
533 $plugin_data = get_plugin_data( $plugin, false, false ); |
|
534 |
|
535 $textdomain = $plugin_data['TextDomain']; |
|
536 if ( $textdomain ) { |
|
537 if ( $plugin_data['DomainPath'] ) { |
|
538 $GLOBALS['wp_textdomain_registry']->set_custom_path( $textdomain, dirname( $plugin ) . $plugin_data['DomainPath'] ); |
|
539 } else { |
|
540 $GLOBALS['wp_textdomain_registry']->set_custom_path( $textdomain, dirname( $plugin ) ); |
|
541 } |
|
542 } |
520 |
543 |
521 $_wp_plugin_file = $plugin; |
544 $_wp_plugin_file = $plugin; |
522 include_once $plugin; |
545 include_once $plugin; |
523 $plugin = $_wp_plugin_file; // Avoid stomping of the $plugin variable in a plugin. |
546 $plugin = $_wp_plugin_file; // Avoid stomping of the $plugin variable in a plugin. |
524 |
547 |
529 * |
552 * |
530 * @param string $plugin Full path to the plugin's main file. |
553 * @param string $plugin Full path to the plugin's main file. |
531 */ |
554 */ |
532 do_action( 'plugin_loaded', $plugin ); |
555 do_action( 'plugin_loaded', $plugin ); |
533 } |
556 } |
534 unset( $plugin, $_wp_plugin_file ); |
557 unset( $plugin, $_wp_plugin_file, $plugin_data, $textdomain ); |
535 |
558 |
536 // Load pluggable functions. |
559 // Load pluggable functions. |
537 require ABSPATH . WPINC . '/pluggable.php'; |
560 require ABSPATH . WPINC . '/pluggable.php'; |
538 require ABSPATH . WPINC . '/pluggable-deprecated.php'; |
561 require ABSPATH . WPINC . '/pluggable-deprecated.php'; |
539 |
562 |
662 $GLOBALS['wp_locale_switcher'] = new WP_Locale_Switcher(); |
685 $GLOBALS['wp_locale_switcher'] = new WP_Locale_Switcher(); |
663 $GLOBALS['wp_locale_switcher']->init(); |
686 $GLOBALS['wp_locale_switcher']->init(); |
664 |
687 |
665 // Load the functions for the active theme, for both parent and child theme if applicable. |
688 // Load the functions for the active theme, for both parent and child theme if applicable. |
666 foreach ( wp_get_active_and_valid_themes() as $theme ) { |
689 foreach ( wp_get_active_and_valid_themes() as $theme ) { |
|
690 $wp_theme = wp_get_theme( basename( $theme ) ); |
|
691 |
|
692 $wp_theme->load_textdomain(); |
|
693 |
667 if ( file_exists( $theme . '/functions.php' ) ) { |
694 if ( file_exists( $theme . '/functions.php' ) ) { |
668 include $theme . '/functions.php'; |
695 include $theme . '/functions.php'; |
669 } |
696 } |
670 } |
697 } |
671 unset( $theme ); |
698 unset( $theme, $wp_theme ); |
672 |
699 |
673 /** |
700 /** |
674 * Fires after the theme is loaded. |
701 * Fires after the theme is loaded. |
675 * |
702 * |
676 * @since 3.0.0 |
703 * @since 3.0.0 |