WordPress: How to move all your plugin code to your theme file so you think you are not actually running any plugins

August 4, 2013

Note (02-27-2014): This article keeps getting traffic and tweets. Though following the steps will actually work this piece is satire and should not be done. See the last section for more details.

In this article I am going to attempt to show you the evil of plugins in WordPress and how you can quickly and easily solve all your plugin woes without using a single plugin.

Plugins are evil!

We have all seen the news of W3 Total Cache and its security vulnerablilities, and most of us have experienced how drastically adding plugins to an application can slow it down to mindbogglingly slow speeds. Plugins are the bane of any WordPress site administrators existence. Why do we over and over submit ourselves to this horrific show, following blindly down the path of “there’s a plugin for that” only to have our sites squashed by the flood of incoming users. Money is lost and tears are shed, yet it does not have to be this way! Following the simple steps outlined in this article you will not only have a site free of plugins, it just may see a performance gain leading to a massive influx of new users.

Get rid of those yucky plugins

For the purposes of this article I am going to be using the theme twentyeleven for demonstration, as it currently comes pre-bundled with WordPress.

The first thing you aught to do is open the wp-content/themes/twentyeleven directory and add a new folder called not-plugins. This folder can really be named anything, but this tutorial will refer to the not-plugins folder.

Now open the wp-content/plugins folder and copy all the contents to the new wp-content/themes/twentyeleven/not-plugins folder.

To easily load the code from the previously existing plugin file(s) lets create a file in wp-content/themes/twentyeleven/not-plugins/include.php. This file will hold links to all our not-plugin code.

Load up include.php

I am going to use a couple plugins that *gasp* I made. Now before you judge me for having created plugins remember that that happened before the era of enlightenment on not using plugins. This is only an example to help you get started without any plugins of your own anyways right? Cut a guy some slack.

Plugins have a single file that controls the loading of the plugin. generally this file is the name of the plugin with dashes instead of spaces and of the form plugin-name/plugin-name.php. This does not have to be the case as the structure is not required by WordPress ( another evil of plugins!!!! ) so you may have to open a couple files to figure it out. The main plugin file will have a comment at the top of it that looks something like:

Plugin Name: Parent Category Toggler
Plugin URI: http://wordpress.org/extend/plugins/parent-category-toggler/
Description: Automatically toggle the parent categories when a sub category is selected.
Version: 1.2
Author: Ben Lobaugh
Author URI: https://ben.lobaugh.net
Original Author: Aw Guo
Original Author URI: http://www.ifgogo.com
Licence: GPL

Open the include.php file and add a new line for each plugin. In this example the include.php file will look like:


require( 'parent-category-toggler/parent-category-toggler.php' );
require( 'misspelling-reporter/misspelling-reporter.php' );

Include the include

The last remaining step is to link the new not-plugins/include.php into the theme to complete the system and provide you a bona fide no plugins needed WordPress installation.

The main theme folder should have a functions.php file. If not create it. This file will be our link. Open functions.php for editing and on the first link you should find a


tag. The line after this opening PHP tag is where we want to put the code linking the not-plugin folder to the rest of the site. It should look like:

require( 'not-plugins/include.php' );

You done it!

Congratulations! Your site it now plugin free :D. If any pesky new plugins make their way onto your site just repeat the steps from moving them into the not-plugins folder.

Now go forth and conquer the web world!


The title of this post graciously provided by the amazing Sir John Hawkins of 9seeds.

‘Lil Rant

This article is poking fun at all of the articles that have been cropping up of late that explain how to add new functionality to a WordPress site without writing a plugin. In reality all you are doing is moving the plugin code into the theme. As shown above it is the exact same code and the whole premise is absurd. Some ( many ) things are better off done as a plugin and not part of the theme. It is perfectly acceptable to run a site with many plugins running. In fact the site you are reading this on has about 30 running, and I have worked on sites with double that number. A poorly written plugin can definitely slow your site down, but the reality of it is that 60 or 1 your site would have slowed down with the bad plugin. Otherwise you will probably not notice a speed decrease. Also using the method listed above locks your plugins in at their version and you will not be able to receive updates with new functionality and security patches.

I know some people will have gotten to this point and still not understand that this is a gag article. It is not real, a hoax, something written to exaggerate an absurdity, a bit of a rant to create a cathartic atmosphere for my heart.

Some Resources

19 thoughts on “WordPress: How to move all your plugin code to your theme file so you think you are not actually running any plugins

  1. Pippin Williamson (August 4, 2013)

    My sites all run 80+ plugins 😀

  2. Richard A. (August 4, 2013)

    I was so confused until I got to the end. All I was thinking was, “What the heck does he mean? It’ll load the same files with 0 performance benefits, he’s gone nuts!”

  3. Julien Maury (@TweetPressFr) (August 4, 2013)

    I have to admit I did not understand it was a joke until the include part but that’s partly because I’m French ^^. I agree with you. Sometimes this “without any plugin mania” tends to be absurd.

  4. Lucy Beer (August 4, 2013)

    Classic! Nicely done Sir Ben! We definitely need to move away from painting the concept of plugins in general as evil and get to the heart of the matter which is, poorly written code that does not follow best practices, is evil.

  5. Husien Adel (August 5, 2013)

    that way suit to all plugins , may be plugins have a lot of files with the same header ?

  6. Jon Brown (August 5, 2013)

    Personally my default install just directly includes all the plugins in the repo so I get ALL the power of all those #AWESOME plugins.

    foreach (glob(“http://plugins.svn.wordpress.org/*) as $filename)
    include $filename;


  7. skane (August 6, 2013)

    This was fun Ben. I moved 37 plugins to my child theme, exported them to Joomla and re-imported (a cleansing, security step), and now I call them from a shortcode named absurd hoax. Life is good.

    1. blobaugh (August 6, 2013)

      Oh! How did I forget the Joomla step? Dang. If you want a good cleanse that is the way to go

  8. Weston Ruter (August 9, 2013)

    LOL. Half-way through I was thinking, “Hey wait, after you require-in your plugins make sure you add do_action( ‘plugins_loaded’ ) to your theme’s functions.php!”

  9. James (August 13, 2013)

    Ha! I admit it, you got me….took me all the way through till the includes section, and then I had to reread it because I was sure I missed something 🙂

  10. Benjamin (August 29, 2013)

    Haha, I really wondered how moving to the theme would change anything to the performance, and most of all, how it would allow for security updates. Well done :).

  11. Russell Aaron (January 12, 2016)

    When I was playing in the young man’s game, I would run one file, uphill in the snow. Both Ways, mind you. We didn’t have these fancy Hula Hoops and Ataris like the young kids have today!

    Great post Ben.

  12. antalya web tasarım (October 10, 2016)

    thanks for such nice sharing

  13. Turab (May 2, 2017)

    Ben you beautiful genius you!

  14. Tdash (June 28, 2017)

    But just including the php files, how will it activate it. I think this is confusing. Can you please explain on the activation part of the plugin too ?

    1. Ben Lobaugh (blobaugh) (July 6, 2017)

      There is no plugin to activate. It just works!

      1. Edison (August 16, 2017)

        Hi, I’m also a bit confused. What about css and js files within the plugin. Wouldn’t the ‘$path’ need to be updated to reflect the new location?

  15. Karn (October 11, 2017)

    What you’re all missing here is that sometimes your host will not allow you to install plugins. I have hundreds of sites on Campus Press and I am only allowed to use the plugins they offer. If I find a neat little plugin in use on another site, and want to use it on a Campus Press site, I have to figure out a way to fold it into my theme. This is a piece of cake for small plugins, but it can get pretty complicated for larger plugins. They review all theme changes before pushing them through, but as long as the faux-plugin I added to the theme doesn’t contain any security issues or disallowed filesystem functions, they usually have no problem approving it.

    My point is that sometimes it’s absolutely essential that I add some sort of functionality to my themes “without a plugin” and that is quite a challenge, but nothing really to make fun of. IT’s frustrating as all hell. It burns me up when someone asks a question on Stack Exchange and all you read are snotty answers from people who can’t understand why you want to do the thing you’re asking to do and spend all of their time explaining why it’s bad practice or why there’s a better way and never simply answering the question: can it be done or not? How? I didn’t ask IF it should be done, I asked HOW it could be done.

    Thanks for the laugh, anyway 🙂

  16. Jina (December 27, 2017)

    Thanks for sharing good blog post about wordpress plugin, I tried all those steps and its working …. I always look your website for new update. Go ahead….