WordPress Tutorial: How to Create a WordPress Plugin

Step 10 – Plugin Hierarchy

WordPress Plugin Hierarchy
WordPress Plugin Hierarchy

Steps to Create a WordPress Plugin

  1. Name Your WordPress Plugin
  2. Isolate Your Plugin From Other Plugins
  3. Organize Your Plugin Files
  4. Define Directory Paths
  5. Load Plugin Files
  6. Directory Structure
  7. Plugin Activation, Plugin Deactivation, and Plugin Uninstallation
  8. Essential Plugin Files
  9. Security: Protect Plugin Files
  10. Plugin Hierarchy

Just to summarize everything, the end result is your plugin structure should look similar to the following outline:

  • mbe-plugin
    • frontend
      • inc
        • class
        • css
        • img
        • js
        • functions.php
        • hooks.php
      • index.php
    • backend
      • inc
        • class
        • css
        • img
        • js
        • activation.php
        • deactivation.php
        • functions.php
        • hooks.php
        • uninstallation.php
      • index.php
    • global
      • inc
        • class
        • css
        • img
        • js
        • functions.php
        • hooks.php
      • index.php
    • index.php

Conclusion

If you read through all of the steps in this tutorial on how to create a WordPress plugin and practiced this with your own plugin name; You should have a very good start on your plugin. This tutorial wasn’t meant to produce a plugin that actually does anything. It’s more or less just a plugin skeleton or plugin boiler plate template, which you can use for pretty much ANY WordPress plugin. The idea here is to get you going with WordPress plugin development practicing: organization, simplicity, isolation, and consistency.

I purposely didn’t include a simple .zip download of these files or a gist because I want you to actually read, and follow along. I feel like you’ll obtain much more of an understanding about creating a WordPress Plugin if you assemble this bits and pieces step by step. If you just download and search/replace, that doesn’t really teach you much.

Resources

I thought it would be helpful to include a list of useful resources to accompany some of the functionality used to compose this plugin shell.

  1. WordPress Plugin Development Handbook
  2. WordPress Plugin Development Codex
  3. WordPress Plugin API
  4. WordPress Coding Standards
  5. WordPress Hooks
  6. WordPress Action Hooks
  7. WordPress Filter Hooks
  8. PHP Namespaces
  9. FAQ: things you need to know about namespaces
  10. PHP Callback Functions
  11. PHP Anonymous Functions
  12. PHP Constants
  13. PHP Magic Constants
  14. WordPress Hooks Database
  15. Advanced WordPress Hooks

 


SOCIALIZE

I’d love to hear what you think of this WordPress plugin development tutorial in the comments. If there’s any portion of this WordPress tutorial that lacks detail or seems unclear, please let me know. The odds are: if you feel that way, someone else probably does too.

If you enjoyed this article, please subscribe to my blog. I try to post educational / informative information about WordPress and much of what relates to Web Design and Website Development in general.

Leave a Reply