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

Group wizard

One session: this hook, then each related_hooks entry. Walk it and tell us what to change.

plugins_loaded → init

functions.php — plugins_loaded
functions.php
PHP plugins_loaded · Hook 1 of 2 · Step 1 of 7

Practice the plugins_loaded WordPress action hook in our interactive sandbox — a VS Code-style editor with a step-by-step plugins_loaded tutorial, add_action exercises, and instant feedback. No local WordPress install required.