0

This question already has an answer here:

Can anyone tell why in all plugins, the index.php is empty? What's the point of it, i can't understand, as it doesn't add any security at all to website, and makes the plugin structure "1-file" more.

p.s. Themes do have index.php,

marked as duplicate by Michael, fuxia Apr 15 '18 at 18: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

It helps to prevent the contents of the plugins folder from being listed if someone was to browse to it. So, yes, it does provide a form of security.

If someone browses to the plugin folder with their web browser, it will just display a blank page instead of a directory listing.

  • no, i mean, why the plugin main file is not written in index.php – T.Todua Apr 15 '18 at 19:28
  • 2
    Because that's not how the WordPress plugin API works – Mat Apr 15 '18 at 23:18
  • can you mention two words about "that's not how the WordPress plugin API works", how writing plugin in index.php conflicts with API? thanks – T.Todua Apr 16 '18 at 8:06

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