Great File Structure for your WordPress Plugin

After you get your developing environment setup and you are ready to start coding, consider what type of file structure you should use for your plugin.  This could be a difficult task so I have decided to share with you my preferred file structure.


This is a very simple plugin file structure, but there are some great things here we should notice.  First of all, there is an uninstall.php.  Make sure to always create an uninstall.php that will remove all the data your plugin created when it is uninstalled.  Next, notice that there is an include directory.  This makes it easy for another developer to quickly understand what files your plugin includes and references.

If we look inside the include folder we see there are four folder containing the main types of files your plugin will include: API source files, images, Javascript, and CSS.  Put all respective files into these folders and add new ones as you need them.  The languages folder will be used to store all files necessary for localizing your plugin.  I usually let a professional translator create those files for me, so for now there is nothing in this folder.  Next is the readme.txt which every plugin needs in order to be eligible for the WordPress repository.  Finally, there is a main file, which in this case is called “general.php”.  This is your main php file that drives your plugin.  Yes, you may have 50 files or this may be your only one, but it should always be at the top directory.  If you find yourself creating a lot of module files, then you should create a new folder called “modules” in the top directory and add those files to it.  Personally, I have never needed this, but some enterprise level plugins need this extra directory because they have so many module files.

Thats it!  If you are having a hard time organizing your plugin’s files, please try this structure out.  Note, I am describing what file structure I believe to be the best for a WordPress plugin, not all plugins.

Please leave any comments below and email us at or with any further questions.

Leave a Reply