• Skip to primary navigation
  • Skip to main content
  • Skip to footer
  • Home
  • Blog
  • Search

Kevin Dees

Full-Stack PHP Development

  • Twitter
  • Github
  • LinkedIn
You are here: Home / PHP / What are WordPress Drop-in Plugins?

What are WordPress Drop-in Plugins?

April 7, 2020 by Kevin 3 Comments

WordPress drop-in plugins are a hidden feature of WordPress used to replace, add, or enhance a limited set of advanced core WordPress features. They are only created by developers or other regular plugins. WordPress drop-in plugins are not regular plugins.

Drop-in plugins are special files that each have a singular and unique purpose within WordPress. For example, you can use a drop-in plugin to replace the core WordPress db.php file and it’s wpdb class. You could also use the advanced-cache.php WordPress drop-in to add “Advanced Caching” to your website (how the caching works is entirely up to the developer, there are no training wheels with drop-ins). Basically each drop-in has its own purpose and each drop-in works in a different way.

Again, to be clear. Even though drop-in plugins appear on the WordPress plugins page, drop-in plugins are not like regular WordPress plugins that you install through the WordPress admin. Nor are they anything like must-use plugins.

All WordPress Drop-In Plugins

FileDescriptionLoadedType
advanced-cache.phpAdvanced caching plugin.If WP_CACHE is trueNormal
db.phpCustom database class.on loadNormal
db-error.phpCustom database error message.on errorNormal
install.phpCustom installation script.on installNormal
maintenance.phpCustom maintenance message.on maintenanceNormal
object-cache.phpExternal object cache.on loadNormal
php-error.phpCustom PHP error message.on errorNormal
fatal-error-handler.phpCustom PHP fatal error handler.on errorNormal
sunrise.phpExecuted before Multisite is loaded.If SUNRISE is trueMultisite
blog-deleted.phpCustom site deleted message.on deleted blogMultisite
blog-inactive.phpCustom site inactive message.on inactive blogMultisite
blog-suspended.phpCustom site suspended message.on archived or spammed blogMultisite

Frequently Asked Questions About WordPress Drop-in Plugins

When were drop-in plugins added to WordPress source? Drop-in plugins were added to WordPress in version 3.0.

When do drop-in plugins get loaded? Most drop-in plugins run before any other regular plugin or MU plugin. The table above also demonstrates the run time of each drop-in.

Where can I see my active WordPress drop-in plugins? Drop-in plugins can be seen in the WordPress admin on the plugins page under Plugins | Drop-in.

How can I activate, deactivate, or uninstall drop-in plugins from the WordPress plugins dashboard? You can not manage drop-in plugins from the WordPress admin, drop-ins can only be managed on your server.

How to Get Started with WordPress Drop-in Plugins

If you wanted to start using drop-in plugins you will not find any organized documentation on wordpress.org about them. This is not the answer you were hoping to hear but it is true.

To get started you will need to look through the WordPress source code and start searching Google. Drop-ins certainly are a hidden feature of WordPress for advanced development.

However, there are a few getting started pointers I can offer if you want to dig deeper.

  1. Browse through the WordPress core and you will find the _get_dropins() function that lists all of the available drop-ins you could install.
  2. To install a drop-in plugin you simply add it directly in the wp-content folder.
  3. When researching a drop-in plugin be specific. Search for the single file that is relevant to your needs (see the list of files below).
  4. Find other regular plugins, like WP Rocket, that install drop-ins and see how they use them.

Below I’ve listed the contents of the _get_dropins() function.

/**
 * Returns drop-ins that WordPress uses.
 *
 * Includes Multisite drop-ins only when is_multisite()
 *
 * @since 3.0.0
 * @return array Key is file name. The value is an array, with the first value the
 *  purpose of the drop-in and the second value the name of the constant that must be
 *  true for the drop-in to be used, or true if no constant is required.
 */
function _get_dropins() {
	$dropins = array(
		'advanced-cache.php'      => array( __( 'Advanced caching plugin.' ), 'WP_CACHE' ), // WP_CACHE
		'db.php'                  => array( __( 'Custom database class.' ), true ), // auto on load
		'db-error.php'            => array( __( 'Custom database error message.' ), true ), // auto on error
		'install.php'             => array( __( 'Custom installation script.' ), true ), // auto on installation
		'maintenance.php'         => array( __( 'Custom maintenance message.' ), true ), // auto on maintenance
		'object-cache.php'        => array( __( 'External object cache.' ), true ), // auto on load
		'php-error.php'           => array( __( 'Custom PHP error message.' ), true ), // auto on error
		'fatal-error-handler.php' => array( __( 'Custom PHP fatal error handler.' ), true ), // auto on error
	);

	if ( is_multisite() ) {
		$dropins['sunrise.php']        = array( __( 'Executed before Multisite is loaded.' ), 'SUNRISE' ); // SUNRISE
		$dropins['blog-deleted.php']   = array( __( 'Custom site deleted message.' ), true ); // auto on deleted blog
		$dropins['blog-inactive.php']  = array( __( 'Custom site inactive message.' ), true ); // auto on inactive blog
		$dropins['blog-suspended.php'] = array( __( 'Custom site suspended message.' ), true ); // auto on archived or spammed blog
	}

	return $dropins;
}

I wish you all the best and hope this article helps you with your WordPress drop-ins plugin journey.

Filed Under: PHP, WordPress

Reader Interactions

Comments

  1. Panos says

    October 21, 2020 at 9:49 am

    Great article! Thank you Kevin, it was exactly what I was searching for.

    Reply
  2. Rodwell Smith says

    December 31, 2020 at 3:12 am

    Can I and do you reccommend removing a Dropin plugin? I have Wp Rocket now but Advanced Cache was a Dropin before I started using WP Rocket.

    Reply
    • Kevin says

      January 4, 2021 at 9:58 am

      To remove a drop-in plugin:

      First – From the WP Admin delete the plugin that installed the drop-in plugin. If you delete the plugin files manually any file/db cleanup the plugin does during its uninstall process is not run.
      Second – Locate the drop-in plugin inside your wp-content folder. If it is not there deleting the old plugin might have removed it for you. If the drop-in plugin is not removed, you can then delete it manually using your preferred method (SFTP, Linux CLI, etc.).

      Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Footer

Get Dare To Code

Get the latest on full-stack PHP development in your inbox with a monthly lesson from Kevin Dees.

Kevin Dees is a speaker, entrepreneur, blogger, and developer. He’s best known for his work in WordPress and podcasting for the retired SitePoint show. Kevin has developed sites for the brands Verizon, Denny’s, RIDGID, Michelin, and others. Currently, he is working on TypeRocket which powers over 10,000 professional websites and products internationally.

Copyright © 2021 · Kevin Dees · Log in