“All The Word That's Fit To Press.”
A WP Engine

How To: Build Your Own Functionality Plugin

Have you ever heard of a functionality plugin?

I stumbled onto this WordPress magic a few years ago and has served me well on many different web projects.

To put it simply, a functionality plugin is a way to separate what you would normally have in a Theme functions.php and place it in your Plugins. All those cool snippets that begin with “function” can be placed here.

Here is my general rule in deciding if a function should be placed in a functionality plugin or in the theme’s functions.php:

Is the function theme exclusive?

So, if you wan to use a temporary maintenance function (a real crowd favorite), you would want to create a functionality plugin for this. This is not theme specific and you would more than likely want this no matter what theme you’re using. In the case of a maintenance mode, it can be much easier to enable, as there’s no code to change–simply enable or disable it in your Plugins as needed.

If you’re creating a custom image size that’s theme specific, you won’t want this as a functionality plugin. Since it’s theme specific, you’ll want to keep this tucked away in your theme’s functions.php.

Admin modifications? No brainer. This belongs in a functionality plugin.

Custom post types? I think this is personal taste, as you usually have to make some theme edits when handling these. My personal preference is the functionality plugin, as I want my custom post types to carry over from theme to theme.

Organize these in a way that makes sense. If there are a standard set of functions you like to have on every site you’re building, you can create your own functionality plugin and add it to each project your working on. You can also keep a generic functionality plugin that you add all your snippets to that are not theme specific. Finally, in the case of the temporary maintenance mode, you will want to keep these types of functions all to themselves.

How-To Build Your Functionality Plugin

I must warn you that if you’ve never built a plugin before, you’re going to feel awesome after you create your own functionality plugin. :)

Here’s how to do it:

Step One

Create a folder and name it whatever you want, but make sure it doesn’t interfere with any of your plugins. The more personal you make it, the less likely that will happen.

Example: eric-dye-functions

Step Two

Open your favorite code or text editor and create a new php file and drop this in:


Plugin Name: Your Site's Functionality Plugin

Description: All of the important functionality of your site belongs in this.

Version: 0.1

License: GPL

Author: Your Name

Author URI: yoururl


Now, add what you would normally place in your functions.php.

Save it in your new folder and name it appropriately.

Step Three

FTP your fancy new functionality plugin to your wp-content/plugins directory. Open your WordPress admin and take a look in your Plugins.

See it?

Good job.

Now simply enable it when you’re ready. If your code is bad or you need to undo your change, simply disable the plugin and make your changes.

Have fun!

[Image via Joe Pemberton via Compfight cc]

More WordPress News From Torque:
  • http://thatblogger.co Daniel Roizer

    Nice post, thanks for sharing this. :) I recently created my own functionality plugin well worth doing.

    • http://ericdye.it Eric Dye

      Indeed it is! A nice little trick and a great way to streamline some WordPress dev work. Thanks Daniel! 😀

  • http://www.expandingdesigns.com Richard Buff

    I like to do this the way Bill Erickson does, http://www.billerickson.net/core-functionality-plugin/, where you create a “mu-plugins” directory, instead of a custom-named directory, and then the client can’t disable it. That might be worth a mention in the article.

    • http://mrwweb.com Mark Root-Wiley

      +1 @Richard

      I came to comment with the sole purpose of mentioning /mu-plugins/! Functionality plugins are the perfect use-case for the folder.

    • http://ericdye.it Eric Dye

      This is awesome! Thanks for the link!

  • http://ottopress.com Otto

    Try Pluginception for this process. Might be a bit quicker for you to follow through those steps. :)

    • http://ericdye.it Eric Dye

      Thanks, Otto. :)

  • http://www.chrisrouse.us Chris Rouse

    I put this to the test today and built my first plugin for one of my functions that needed to be by itself.

    I had a long function that displayed the featured image in the Post list in the admin panel. I did some digging and found some better code for that to do something else I wanted it to do, then I converted it into a plugin.

    Thanks for the tutorial, Eric!


    • http://ericdye.it Eric Dye


      I love what you’ve done. 😀

  • http://cleanforest.co Noam

    This sample functionality plugin contains various useful code snippets:


    • http://ericdye.it Eric Dye


      Great stuff.

      Thanks, Noam.

  • http://www.davidclements.me Dave Clements

    So glad to see this getting pushed in other prominent WordPress blogs. I’ve been a stickler on this for years and try and encourage everyone to build a functionality plugin.

    • http://ericdye.it Eric Dye

      Thank you for the encouragement Dave! 😀

  • http://tomjamieson.com Tom Jamieson

    Very cool idea! I will def give it a try. Thanks for the simple explanation.

    • http://ericdye.it Eric Dye

      Sure thing! Glad to help. :)

  • http://boluda.com/ Joan

    For even more granular control, I use Code Snippets:


    Very helpful! Although Bill Erickson’s is the best way, IMHO.

  • Dev Demo

    it’s very bad code..i m not happy for this…

  • http://www.savoiretcroire.ca/ Daniel Garneau

    This article – along with and with http://torquemag.io/functionality-plugin/ – helped me create my first WordPress plugin : a very simple one with only three lines of codes, adding a handle to my JetPack Share Twitter button (http://wpspeak.com/adding-twitter-handle/). Mille mercis!