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.

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.

1 Answer 1

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.