WordPress.org

Codex

Attention Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Plugin API/Action Reference/wp loaded

This page is marked as incomplete. You can help Codex by expanding it.

Description

This action hook is fired once WordPress, all plugins, and the theme are fully loaded and instantiated.

Usage

add_action('wp_loaded','your callback function');

Example

// Minify HTML codes when page is output.
add_action('wp_loaded','my_minify_html');
function my_minify_html(){
	/** 
	 * use html_compress($html) function to minify html codes.
	 */
	ob_start('html_compress');
}

function html_compress($html){
	/** 
	 * some minify codes here ...
	 */
	return $html;
}

Notes

AJAX requests should use wp-admin/admin-ajax.php. admin-ajax.php can handle requests for users not logged in.

Change Log

Since: 3.0

Source File

wp_loaded is located in wp-settings.php