From fa082ecca58b0e24efff5ecbd239a8b43759c7cb Mon Sep 17 00:00:00 2001 From: Dion Hulse Date: Sun, 28 Feb 2010 03:08:16 +0000 Subject: [PATCH] add a wp_loaded action that fires once WordPress init has finished. Props Denis-de-Bernardy. See #12400 git-svn-id: https://develop.svn.wordpress.org/trunk@13481 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-settings.php | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/wp-settings.php b/wp-settings.php index b82673c8dd..b824e69e99 100644 --- a/wp-settings.php +++ b/wp-settings.php @@ -277,7 +277,22 @@ register_shutdown_function( 'shutdown_action_hook' ); // Set up current user. $wp->init(); -// Everything is loaded and initialized. +/** + * 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' ); +/** + * The purpose of this hook is to fire actions once WP, all plugins, and the theme, + * are fully loaded and instantiated. + * + * AJAX requests should use wp-ajax.php and wp-admin/admin-ajax.php instead. + * + * @since 3.0 + */ +do_action('wp_loaded'); ?>