What to look for in WordPress themes: Pluggability

Share this!

In choosing a theme for your WordPress Web site, you might be inclined to focus on layout and look and feel. Maybe you also consider end-user customizability and how many (and which) template files are included in the theme.

WordPress Themes DirectoryIf you’re a civilian building your own Web presence with WordPress, by all means pick the theme that most closely matches what you’re looking for along those dimensions.

But if you’re a designer/developer (or a civilian working with a designer/developer), there are other important considerations. Most likely, you (or your designer/devloper) will have to look under the hood of the theme to find out whether it passes the tests.

Action hook template tags

Probably the most important other consideration is whether the theme includes the four critical action hook template tags:

  • wp_head()
  • wp_footer()
  • wp_meta()
  • comment_form()

The importance of including these hooks in themes is so paramount and has been touted for so long that it’s hard to imagine that many themes don’t include them. (According to the current WordPress.org Theme Review Guidelines, a theme won’t even be accepted into the WordPress Theme Directory if it lacks them.)

So, assuming the theme you plan to use does include those hooks, what’s the next other important consideration?


A theme is pluggable to the extent that the php functions that define how it works and appears can be replaced by php functions in a child theme’s functions.php file.

That might sound complicated. But it isn’t.

What does a pluggable function look like?

if ( ! function_exists( 'theme_special_feature' ) ) {
	function theme_special_feature() {
	//  Do something.

Yep. It’s as simple as that. The function theme_special_feature() is pluggable because it’s wrapped around the conditional statement that dictates…

If the function I want to declare does not (the “!” in line 1) already exist in memory (aka hasn’t already been declared by something else such as the child theme’s functions.php file which, keep in mind, is loaded before the parent’s functions.php file), then go ahead and declare it. Otherwise, never mind.

Now for a little background/review on the WordPress action execution order.

(If you’re not familiar with child theming and its many benefits, check out the resources at the end of this article.)

WordPress Action Execution Order

If you’re a designer/developer who utilizes child theming, you probably know that the child theme’s style.css file and any child theme template files override their namesakes from the parent. In other words, if WordPress finds style.css in the child theme directory, it won’t scan the parent theme directory for a file named style.css. The same is true for any of the template files (e.g., page.php, single.php, etc.)

Your child theme’s functions.php file operates differently, however.

Functions in your child theme’s functions.php file are loaded in addition to the functions in the parent’s functions.php file. Specifically, the functions in your child theme’s function.php file are loaded first.

So, as long as the names of the functions in your child theme’s functions.php file are different from the names of the functions in the parent theme’s functions.php file, all of the functions in both functions.php files will be loaded and ready for action.

What if there are name conflicts?

This is where things get interesting. And potentially problemmatic. (And it’s also where pluggability comes into the picture.)

If your child theme’s functions.php file has a function with the same name as a function in the parent’s functions.php file and the parent’s function is not pluggable, you’re going to generate a fundamental PHP error: you cannot redeclare functions!

So, a theme developer who wants to allow site developers to extend or enhance (i.e., replace) functions in his/her functions.php file will make those functions pluggable.


Next time you’re evaluating themes for your WordPress site, take a look under the hood of the theme’s functions.php file to see how pluggable the theme is.

Share this!

About JeffCohan.com

The nSiteful Tech Blog (the official blog of nSiteful Web Builders, Inc. since January of 2013) is where I (Jeff Cohan) and (occasionally) associates will be posting articles of potential interest to like-minded techies, nSiteful clients who are playing active roles in the maintenance of their own Web sites and blogs, and pretty much anyone interested in how Web strategies and tools can help them reach their goals.

This entry was posted in General and tagged , , by Jeff Cohan. Bookmark the permalink.

About Jeff Cohan

Jeff and his wife, Margie, are the proud parents of Sarah and Jake. Jeff is the founder, president and chief cook and bottle washer of nSiteful Web Builders, Inc., a Web development and Internet Consulting firm. In his spare time, Jeff builds Web sites and Web applications, plays guitar, putters around in his basement woodworking shop, mercilessly spoils his grandchildren, and creates videos from more than two decades of home movies. His current video project is an extended montage of people (mainly family members) asking him to stop filming them.

Leave a Reply

Your email address will not be published. Required fields are marked *