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,


1 Answer 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
    Commented Apr 15, 2018 at 19:28
  • 2
    Because that's not how the WordPress plugin API works
    – Mat
    Commented Apr 15, 2018 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
    Commented Apr 16, 2018 at 8:06

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