I was asked a few weeks ago why I structured my WordPress plugins the way I do.
Anyone who has spent any time looking at my code knows that I like to keep my main functions in a class and wire up action hooks and filters in the root of the plugin. But few people have asked me why I set things up this way.
My explanation is in two parts:
- Writing clean code
- Writing easy-to-maintain code
Though it should be noted now that, while this particular development style makes heavy use of classes within PHP, this is not object-oriented programming.
Let me say again – this is not object-oriented programming. I use classes often to define custom objects, but in this situation I use them merely as convenient wrappers for code. Continue reading…




