How do plugins get executed automatically from wp-content?

Most plugins that are installed into /wp-content/plugins need to be activated. However, it seems that if you drop scripts directly into /wp-content (object-cache.php comes to mind) they are activated automatically.

How is this?

Related posts

Leave a Reply

3 comments

  1. I know, myself, using a multi site WordPress install, plugins dropped into the mu-plugins folder (wp-content/mu-plugins/) are activated automatically. In this case mu representing must use.

    However, I am not 100% positive if this is dependent upon the type of install a single site blog install or multi site/network install.

    I found an article outlining most of the information about mu and drop in plugins that I know here.

    Additionally, if you are looking specifically for how these plugins are loaded I opened up /wp-admin/includes/plugin.php and found get_mu_plugins() on line 279.

  2. There is number of specially named files that get loaded automatically when present. They are called Drop-ins and are displayed in Plugins interface when present (since some recent WP versions).

    They can be added by regular plugin or manually.

    Note that this only works for specific files. Those that are not recognized as drop-in won’t run automatically and will require activation as usual or placing them in mu-plugins.