Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I cannot find documentation or discussions on what is and how to use Drop-in plugins.
The question was raised in this Q&A, Populate content on install.

Is a wp-content/install.php file that redefines the pluggable function wp_install_defaults a Drop-in plugin or not?

My research results

The following list is from hakre's article (which seems to be the origin of all other copies in the interwebs).

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

Source: Data taken from global function _get_dropins() in wp-admin/includes/plugin.php.

In the Codex a Drop-in is defined as:

The concrete PHP-file


At first, there's nothing on [wp-hackers] list. And searching for "drop-in + wordcamp" I've only found this of relevance my emphasis:

One of the great strengths of WordPress is its plugin system. In the upcoming 2.1 release, there is very little you can’t do as a drop-in plugin. This makes it easy to use WordPress as a CMS and keep your customizations separate from the main codeline; which in turn simplifies upgrades and maintenance.

share|improve this question
1  
Isn't it just semantics? Not being a native english speaker I fail to see the implied distinction between "drop-in plugin" and "plugin" –  Mark Kaplun Dec 9 '12 at 14:21
    
@MarkKaplun : No, no, it's not about semantics. The question is on the 3rd sentence: Is a wp-content/install.php file that redefines [...] –  brasofilo Dec 9 '12 at 14:26
    
I don’t get what you are out for. You know already drop-ins are files loaded like mu-plugins, just without a plugin header. What is open? –  toscho Dec 9 '12 at 14:31
    
@toscho, to the point: Wyck said that wp-content/intall.php is not a Drop-in. Trusting his knowledge, I thought that a Question was needed to clarify that. If not, I'll gladly delete this. I don't want to create any other polemic topic. –  brasofilo Dec 9 '12 at 14:38
    
That would make a better question: Is install.php a drop-in? –  toscho Dec 9 '12 at 14:44
show 1 more comment

2 Answers

up vote 6 down vote accepted

To answer your question, Yes

In fact, there are many other functions you can override in that file, it's included as the first line of "wp-admin/includes/upgrade.php" & there are many functions inside to be overridden

Unfortunately, there is not too much information available regarding drop-in plugins but i'll try to put a few points

  1. They are distinct to normal plugins in the sense that they can't be packaged & installed through wordpress admin.
  2. Using them means the owner manually uploaded the plugin at the correct location. So it's assumed that it's written & added by the owner themselves.
  3. These plugins are only meant to have code specific to the particular wordpress site.
  4. Since they are added by the owner, they can't be controlled (activated/deactivated) from admin panel. The include statement is hardcoded in the core.
  5. They don't need to have any file headers.

To summarize, they are php files hardcoded to be included(if exist), whenever the corresponding functionality is being loaded by wordpress.

To use them, just create a php file with that name inside the "wp-content" directory & it will be automatically included. That file can of course include any number of other files as needed.

EDIT

As toscho pointed out,
1) Drop-ins(if available) are also listed in the wordpress admin panel with all the other plugins. Though unlike other plugins, you don't have the control to de-activate them from there.
2) Wordpress, when upgrading itself(core upgrade), does not alter the "wp-content" directory. For this reason, these plugins never change between upgrades.
3) You can define a constant in the wp-config.php to change the "wp-content" directory to some other. The constant you need to define is WP_CONTENT_DIR. This also changes the defaults for other constants such as plugins directory, so you'll need to take care of that as well, if needed

share|improve this answer
2  
You might add they survive a WordPress update, are listed in the plugin admin page, and you can define additional drop-in paths in wp-config.php. –  toscho Dec 9 '12 at 14:53
    
Nice summary, Mridul. I've just searched the core and yes, you're almost translating into english what the code says. –  brasofilo Dec 9 '12 at 15:07
add comment

How wp-content/install.php works;

The WP installation process runs wp-admin/install.php

On line 39 of the install it runs wp-admin/includes/upgrade.php

require_once( dirname( __FILE__ ) . '/includes/upgrade.php' );

This file then check for a user generated install.php first and if not found runs the default install as seen by this code;

( file_exists(WP_CONTENT_DIR . '/install.php') )
    require (WP_CONTENT_DIR . '/install.php');
share|improve this answer
    
In what manner does this workflow affects our install.php being a Drop-in or not? –  brasofilo Dec 9 '12 at 17:08
    
It still a "drop-in" I just wanted to make a distinction with an mu-plugin I commented above, sorry for the confusion, I think Mridul Aggarwal's is correct. –  Wyck Dec 9 '12 at 18:43
    
No prob, I really got confused. But, if the system calls Must-use one kind and Drop-in another kind, we should stick to the convention. Cheers :) –  brasofilo Dec 9 '12 at 18:56
    
Ya the naming conventions should be more clear, but also most people don't know about the custom install.php –  Wyck Dec 9 '12 at 19:04
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.