WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

If my plugin has multiple php files in its plugin folder, how does WordPress know which is the main php file ?

share|improve this question

marked as duplicate by toscho Jun 26 '13 at 10:36

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

up vote 3 down vote accepted

WordPress has no convention for naming of main file. It scans whole plugins directory (see get_plugins() ) and looks for plugin header (with get_plugin_data())in every PHP file on appropriate directory levels.

This is only performed when you actually need full list of plugins. Thing like active plugins are calculated and stored separately so that for it there is no need for search every load.

Note that this has curious side effect of technically allowing more than one main plugin file in plugin folder. All kinds of bad idea, don't go there. :)

share|improve this answer

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