I developed a plugin using the normal convention of naming the main plugin file after the plugin folder (i.e. prefix-someplugin
for the folder and prefix-someplugin.php
for the file). However, I saw some plugins that use the following structure:
prefix-someplugin
- plugin-loader.php // This file just loads src/prefix-someplugin.php
- /src
- prefix-someplugin.php
Obviously, if they used such structure, it means that it works. The issue is that I'm not sure how it works, hence my question. How does WP know which file to load as the main plugin file? I would have assumed that it looked for a file named after a folder, just adding .php
as an extension, but it seems I was wrong.
Does WPjust scan wp-content/plugins
for folders, and loads all the files it finds in them, or does it follow a different logic?
Thanks in advance for the answers.