If my plugin has multiple php files in its plugin folder, how does WordPress know which is the main php file ?
1 comment
Comments are closed.
If my plugin has multiple php files in its plugin folder, how does WordPress know which is the main php file ?
Comments are closed.
WordPress has no convention for naming of main file. It scans whole plugins directory (see
get_plugins()
) and looks for plugin header (withget_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. 🙂