Page 3 of 3

Drop-ins Plugins

WordPress drop-ins are custom php Must-Use files related to some core files such as db.php, advanced-cache.php and object-cache.php that you can place in the wp-content directory to override the core file with new functionality.

List of WordPress Drop-Ins

File Type of Plugin Loaded Context
advanced-cache.php Advanced caching plugin. on WP_CACHE value Single
db.php Custom database class always Single
db-error.php Custom database error message on error Single
install.php Custom install script on install Single
maintenance.php Custom maintenance message on maintenance Single
object-cache.php External object cache always Single
sunrise.php ‘Executed before Multisite is loaded on SUNRISE value Multi
blog-deleted.php Custom blog deleted message on deleted blog Multi
blog-inactive.php Custom blog inactive message on inactive blog Multi
blog-suspended.php Custom blog suspended message on archived or spammed blog Multi

This list is extracted from global function _get_dropins() in wp-admin/includes/plugin.php.

Must Use Plugins

Must-Use plugins are standard wordpress plugins, just that they reside in the mu-plugins directory (wp-content/mu-plugins). Plugins residing in this directory are automatically activated. The only way to deactivate them is to delete the plugin files from the mu-plugins directory.

The plugin files do not need to contain plugin headers, so you just need to create a PHP file and that’s it. These MU plugins are listed as ‘Must-Use’ in the plugins page in the WordPress admin.

What’s so great about this when we can easily place our code in the theme’s functions.php? Well, I can find use for this when creating post types, taxonomies, or shortcodes. By separating such codes from functions.php, I’m saving myself the trouble of transferring the code, or breaking my WordPress site when I need to switch themes.

Also, this has advantage over regular plugins found in the plugins directory (wp-content/plugins). For developers, must-use plugins prevent clients from disabling codes that are crucial to their site.

However, take note that WordPress looks in the mu-plugins directory for php files and not in its subdirectories. So if you want to move regular plugins which reside in their own subdirectories into wp-content/mu-plugins, you’ll probably need to create a proxy php file that contains require_once() or include_once() to include the plugin’s main php file from its subdirectory. An easy way is to create a single php file to include all the plugins found in mu-plugins sub-directories.

© 2020 Bucket Press