equal
deleted
inserted
replaced
18 define( 'WPINC', 'wp-includes' ); |
18 define( 'WPINC', 'wp-includes' ); |
19 |
19 |
20 // Include files required for initialization. |
20 // Include files required for initialization. |
21 require( ABSPATH . WPINC . '/load.php' ); |
21 require( ABSPATH . WPINC . '/load.php' ); |
22 require( ABSPATH . WPINC . '/default-constants.php' ); |
22 require( ABSPATH . WPINC . '/default-constants.php' ); |
|
23 |
|
24 /* |
|
25 * These can't be directly globalized in version.php. When updating, |
|
26 * we're including version.php from another install and don't want |
|
27 * these values to be overridden if already set. |
|
28 */ |
|
29 global $wp_version, $wp_db_version, $tinymce_version, $required_php_version, $required_mysql_version; |
23 require( ABSPATH . WPINC . '/version.php' ); |
30 require( ABSPATH . WPINC . '/version.php' ); |
24 |
31 |
25 // Set initial default constants including WP_MEMORY_LIMIT, WP_MAX_MEMORY_LIMIT, WP_DEBUG, WP_CONTENT_DIR and WP_CACHE. |
32 // Set initial default constants including WP_MEMORY_LIMIT, WP_MAX_MEMORY_LIMIT, WP_DEBUG, WP_CONTENT_DIR and WP_CACHE. |
26 wp_initial_constants(); |
33 wp_initial_constants(); |
27 |
34 |
110 require( ABSPATH . WPINC . '/date.php' ); |
117 require( ABSPATH . WPINC . '/date.php' ); |
111 require( ABSPATH . WPINC . '/theme.php' ); |
118 require( ABSPATH . WPINC . '/theme.php' ); |
112 require( ABSPATH . WPINC . '/class-wp-theme.php' ); |
119 require( ABSPATH . WPINC . '/class-wp-theme.php' ); |
113 require( ABSPATH . WPINC . '/template.php' ); |
120 require( ABSPATH . WPINC . '/template.php' ); |
114 require( ABSPATH . WPINC . '/user.php' ); |
121 require( ABSPATH . WPINC . '/user.php' ); |
|
122 require( ABSPATH . WPINC . '/session.php' ); |
115 require( ABSPATH . WPINC . '/meta.php' ); |
123 require( ABSPATH . WPINC . '/meta.php' ); |
116 require( ABSPATH . WPINC . '/general-template.php' ); |
124 require( ABSPATH . WPINC . '/general-template.php' ); |
117 require( ABSPATH . WPINC . '/link-template.php' ); |
125 require( ABSPATH . WPINC . '/link-template.php' ); |
118 require( ABSPATH . WPINC . '/author-template.php' ); |
126 require( ABSPATH . WPINC . '/author-template.php' ); |
119 require( ABSPATH . WPINC . '/post.php' ); |
127 require( ABSPATH . WPINC . '/post.php' ); |
155 |
163 |
156 // Define constants that rely on the API to obtain the default value. |
164 // Define constants that rely on the API to obtain the default value. |
157 // Define must-use plugin directory constants, which may be overridden in the sunrise.php drop-in. |
165 // Define must-use plugin directory constants, which may be overridden in the sunrise.php drop-in. |
158 wp_plugin_directory_constants(); |
166 wp_plugin_directory_constants(); |
159 |
167 |
|
168 $GLOBALS['wp_plugin_paths'] = array(); |
|
169 |
160 // Load must-use plugins. |
170 // Load must-use plugins. |
161 foreach ( wp_get_mu_plugins() as $mu_plugin ) { |
171 foreach ( wp_get_mu_plugins() as $mu_plugin ) { |
162 include_once( $mu_plugin ); |
172 include_once( $mu_plugin ); |
163 } |
173 } |
164 unset( $mu_plugin ); |
174 unset( $mu_plugin ); |
165 |
175 |
166 // Load network activated plugins. |
176 // Load network activated plugins. |
167 if ( is_multisite() ) { |
177 if ( is_multisite() ) { |
168 foreach( wp_get_active_network_plugins() as $network_plugin ) { |
178 foreach( wp_get_active_network_plugins() as $network_plugin ) { |
|
179 wp_register_plugin_realpath( $network_plugin ); |
169 include_once( $network_plugin ); |
180 include_once( $network_plugin ); |
170 } |
181 } |
171 unset( $network_plugin ); |
182 unset( $network_plugin ); |
172 } |
183 } |
173 |
184 |
179 do_action( 'muplugins_loaded' ); |
190 do_action( 'muplugins_loaded' ); |
180 |
191 |
181 if ( is_multisite() ) |
192 if ( is_multisite() ) |
182 ms_cookie_constants( ); |
193 ms_cookie_constants( ); |
183 |
194 |
184 // Define constants after multisite is loaded. Cookie-related constants may be overridden in ms_network_cookies(). |
195 // Define constants after multisite is loaded. |
185 wp_cookie_constants(); |
196 wp_cookie_constants(); |
186 |
197 |
187 // Define and enforce our SSL constants |
198 // Define and enforce our SSL constants |
188 wp_ssl_constants(); |
199 wp_ssl_constants(); |
189 |
200 |
197 |
208 |
198 // Register the default theme directory root |
209 // Register the default theme directory root |
199 register_theme_directory( get_theme_root() ); |
210 register_theme_directory( get_theme_root() ); |
200 |
211 |
201 // Load active plugins. |
212 // Load active plugins. |
202 foreach ( wp_get_active_and_valid_plugins() as $plugin ) |
213 foreach ( wp_get_active_and_valid_plugins() as $plugin ) { |
|
214 wp_register_plugin_realpath( $plugin ); |
203 include_once( $plugin ); |
215 include_once( $plugin ); |
|
216 } |
204 unset( $plugin ); |
217 unset( $plugin ); |
205 |
218 |
206 // Load pluggable functions. |
219 // Load pluggable functions. |
207 require( ABSPATH . WPINC . '/pluggable.php' ); |
220 require( ABSPATH . WPINC . '/pluggable.php' ); |
208 require( ABSPATH . WPINC . '/pluggable-deprecated.php' ); |
221 require( ABSPATH . WPINC . '/pluggable-deprecated.php' ); |
217 /** |
230 /** |
218 * Fires once activated plugins have loaded. |
231 * Fires once activated plugins have loaded. |
219 * |
232 * |
220 * Pluggable functions are also available at this point in the loading order. |
233 * Pluggable functions are also available at this point in the loading order. |
221 * |
234 * |
222 * @since 1.5.2 |
235 * @since 1.5.0 |
223 */ |
236 */ |
224 do_action( 'plugins_loaded' ); |
237 do_action( 'plugins_loaded' ); |
225 |
238 |
226 // Define constants which affect functionality if not already defined. |
239 // Define constants which affect functionality if not already defined. |
227 wp_functionality_constants(); |
240 wp_functionality_constants(); |
239 /** |
252 /** |
240 * WordPress Query object |
253 * WordPress Query object |
241 * @global object $wp_the_query |
254 * @global object $wp_the_query |
242 * @since 2.0.0 |
255 * @since 2.0.0 |
243 */ |
256 */ |
244 $wp_the_query = new WP_Query(); |
257 $GLOBALS['wp_the_query'] = new WP_Query(); |
245 |
258 |
246 /** |
259 /** |
247 * Holds the reference to @see $wp_the_query |
260 * Holds the reference to @see $wp_the_query |
248 * Use this global for WordPress queries |
261 * Use this global for WordPress queries |
249 * @global object $wp_query |
262 * @global object $wp_query |
250 * @since 1.5.0 |
263 * @since 1.5.0 |
251 */ |
264 */ |
252 $wp_query = $wp_the_query; |
265 $GLOBALS['wp_query'] = $GLOBALS['wp_the_query']; |
253 |
266 |
254 /** |
267 /** |
255 * Holds the WordPress Rewrite object for creating pretty URLs |
268 * Holds the WordPress Rewrite object for creating pretty URLs |
256 * @global object $wp_rewrite |
269 * @global object $wp_rewrite |
257 * @since 1.5.0 |
270 * @since 1.5.0 |
261 /** |
274 /** |
262 * WordPress Object |
275 * WordPress Object |
263 * @global object $wp |
276 * @global object $wp |
264 * @since 2.0.0 |
277 * @since 2.0.0 |
265 */ |
278 */ |
266 $wp = new WP(); |
279 $GLOBALS['wp'] = new WP(); |
267 |
280 |
268 /** |
281 /** |
269 * WordPress Widget Factory Object |
282 * WordPress Widget Factory Object |
270 * @global object $wp_widget_factory |
283 * @global object $wp_widget_factory |
271 * @since 2.8.0 |
284 * @since 2.8.0 |
322 * @since 3.0.0 |
335 * @since 3.0.0 |
323 */ |
336 */ |
324 do_action( 'after_setup_theme' ); |
337 do_action( 'after_setup_theme' ); |
325 |
338 |
326 // Set up current user. |
339 // Set up current user. |
327 $wp->init(); |
340 $GLOBALS['wp']->init(); |
328 |
341 |
329 /** |
342 /** |
330 * Fires after WordPress has finished loading but before any headers are sent. |
343 * Fires after WordPress has finished loading but before any headers are sent. |
331 * |
344 * |
332 * Most of WP is loaded at this stage, and the user is authenticated. WP continues |
345 * Most of WP is loaded at this stage, and the user is authenticated. WP continues |
333 * to load on the init hook that follows (e.g. widgets), and many plugins instantiate |
346 * to load on the init hook that follows (e.g. widgets), and many plugins instantiate |
334 * themselves on it for all sorts of reasons (e.g. they need a user, a taxonomy, etc.). |
347 * themselves on it for all sorts of reasons (e.g. they need a user, a taxonomy, etc.). |
335 * |
348 * |
336 * If you wish to plug an action once WP is loaded, use the wp_loaded hook below. |
349 * If you wish to plug an action once WP is loaded, use the wp_loaded hook below. |
337 * |
350 * |
338 * @since 1.5.2 |
351 * @since 1.5.0 |
339 */ |
352 */ |
340 do_action( 'init' ); |
353 do_action( 'init' ); |
341 |
354 |
342 // Check site status |
355 // Check site status |
343 if ( is_multisite() ) { |
356 if ( is_multisite() ) { |
352 * This hook is fired once WP, all plugins, and the theme are fully loaded and instantiated. |
365 * This hook is fired once WP, all plugins, and the theme are fully loaded and instantiated. |
353 * |
366 * |
354 * AJAX requests should use wp-admin/admin-ajax.php. admin-ajax.php can handle requests for |
367 * AJAX requests should use wp-admin/admin-ajax.php. admin-ajax.php can handle requests for |
355 * users not logged in. |
368 * users not logged in. |
356 * |
369 * |
357 * @link http://codex.wordpress.org/AJAX_in_Plugins |
370 * @link https://codex.wordpress.org/AJAX_in_Plugins |
358 * |
371 * |
359 * @since 3.0.0 |
372 * @since 3.0.0 |
360 */ |
373 */ |
361 do_action( 'wp_loaded' ); |
374 do_action( 'wp_loaded' ); |