Brady Vercher wrote an insightful post…
Brady Vercher wrote an insightful post about how he’s been structuring his WordPress plugins. His methods are interesting and his closing advice is good:
Itβs not meant to be dogmatic, but if youβre struggling with structure or spending too much time scaffolding new plugins,Β give it a shot and see what you think.
No matter your approach, here are some things I do recommend:
- Define the main plugin class in its own file (not the in the main plugin file).
- Donβt register hooks in constructors.
- Donβt execute code in the same file where functions or classes are defined.