Action Hook since 1.5.0
plugins_loaded
Fires once all active plugins have loaded
Description
plugins_loaded is the earliest point where every active plugin's functions and classes are guaranteed to exist — use it for cross-plugin checks, not for registering WordPress objects.
When it runs
Every request, right after plugin files are included and before after_setup_theme / init. Runs on front-end, admin, and AJAX alike.
Signature
do_action( 'plugins_loaded' );Examples
Basic
add_action( 'plugins_loaded', function() {
if ( class_exists( 'WooCommerce' ) ) {
require_once __DIR__ . '/integrations/woocommerce.php';
}
} );Load an integration file only when WooCommerce is active.
Real case
add_action( 'plugins_loaded', function() {
load_plugin_textdomain( 'my-plugin', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
} );Load plugin translations before any strings are output.
Common Use Cases
- Check if another plugin/class exists
- Load plugin translations
- Bootstrap plugin dependencies
- Set up autoloaders
Common mistakes
- Registering post types or taxonomies here instead of init — some APIs aren't ready yet
Related hooks
FAQ
Is plugins_loaded too early for register_post_type?
Yes for some setups — use init instead; plugins_loaded is for dependency checks, not registering WordPress objects.
Source: wp-settings.php