WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have developed my own WordPress theme based on the Roots starter theme. Because of my clients needs, I'm often required to develop custom features (what I refer to as "modules") that are added to the core: for example a "Projects" custom post type, a "Business Hours" page in the admin, or a custom "Slider" menu, etc.

There's a couple reasons why I decided to code these modules and extend the theme instead of using existing plugins:

  • It's a great way to learn WordPress
  • I need to bundle and activate the modules dynamically in every new projects
  • I don't want the clients to be able to deactivate the features (unlike plugins)
  • I don't want to rely too much on third-parties
  • For consistency matters, I like if the code is similar everywhere
  • Flexibility: from my experience home-made modules are often easier to understand, maintain, and improve in the future

I do however understand that building my features as plugins would brings a better code separation and have it's benefits.

So here's my question: Should I keep building and adding the new features directly to the theme, or develop them as plugins instead? What is the best approach based on your knowledge and experience?

Any input or documentation would be very appreciated. Thanks!

share|improve this question
up vote 1 down vote accepted

If you're going to want to mix-and-match these modules, I would suggest developing them as plugins or using a plugin such as Code Snippets to separate your modules, making them easier to work on, expand upon, and deactivate/activate.

Either way, separating your modules from your theme will make customizing deployments faster while increasing the organization of your code.

share|improve this answer
Great point: I now realize that plugins would be more flexible but there are still a few concerns though: - How to I prevent the user from deactivating a plugin? - Is there a better way to require plugins when activating a theme beside the TGM Plugin Activation library? I guess I could always create some kind of script that would activate the theme with the right modules at the start of the project... – Frank Parent Jun 4 '14 at 18:44
WordPress has filters for just this purpose! You can remove plugin controls for the plugins you specify using the plugin_action_links filter. Here's a tutorial on how to do it. For single file plugins that don't have activation hooks, you could place them in mu-plugins, but you may run into issues with that. – Gabe Rose Jun 4 '14 at 19:01
Thanks Gabe, that's good enough to convince me to change my approach :) I'll find a nice plugin boilerplate and give it a shot! Thanks again mate. – Frank Parent Jun 5 '14 at 16:55

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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