(Reading time: 3 – 4 minutes)
This little article isn’t for everyone, but if you have ever wondered exactly what a WordPress plugin is, it’s for you. Also, I have an ulterior motive for this snappy little article, but you’ll have to wait for a couple of weeks to find out.
The short answer is this:
A WordPress plugin is it’s “Plugin name,” which must be in a file where WordPress can find it when WordPress scans for plugins.
As long as you have at least this, WordPress will activate and register your plugin:
1 | <?php /* Plugin name: A Minimal Plugin */ ?> |
One line, can’t get any shorter than this.
How WordPress plugins work
- WordPress scans the plugin directory.
- Files in the plugin directory are parsed for “Plugin name.”
- Plugin state is stored in options table
Disclaimer: this is based on 1. common sense, and 2. cursory inspection of the WordPress source code. I’ll be doing more digging later into the scanning and parsing code.
Screencast!!!
Uh, no. Youtube is down. Can’t upload. Can’t link. Bummer. Maybe later.
See how easy that is? Here’s the script:
- Introduction and explanation of minimal plugin. Why I always seem to have a cold when I make these screencasts is beyond me.
- The plugin name is “A Minimal Plugin” and it’s located in
wp-content/plugins/minimal.php. You’ll see the file name when we look at the active_plugins key in the options table in the WordPress database. In any case, we activate the plugin here. - After activating A Minimal Plugin, we take a look at the source code. It’s really just one line, but the WordPress editor reformats for display, something you need to know about if you take on any programming in WordPress. (It’s also intensely annoying and will screw up your escape codes.)
- Next we examine the
options.phppage which lists out the keys and values for the options table in the WordPress database. The data containing plugin names is serialized, not shown in this display. - Lastly, a quick check of the
active_pluginskey using an SQL browser shows, indeed, that theminimal.phpfile name is stored.
In a couple of weeks, I’m going to show you why this is important when you’re building plugins for yourself. (Weekenders are going to get why you should consider building (or having your web team build) your own little plugins too.)
Your turn
Implement this plugin and take a screen shot, I’ll link the first three here:
- First up is Ricky Buchanan, posting her screenshot example on Skitch. Very cool!
- Second isn’t bad… here’s Marshall’s:
Visit Marshall & family at Real Off Grid Living.
- Third, could be worse.
Seriously, this takes about 5 minutes to do, and you will get something out of it. (deliberate practice)
Would you like more? Send me a letter...



{ 8 comments }
It’s nice to know. I’ll let someone else practice, I trust your word on it actually working like that

Anne´s last blog ..Is Someone Stealing Away Your Affiliate Revenue?
Anne, I’ll never need to “discuss” how WordPress treats plugins.
Dave Doolin´s last blog ..Atahualpa Theme – Pixel Perfection, No Inca Required
Nice.
This article has already been ripped off for a multiple placement on a cell phone sales site.
Jerks.
I’m going to start cutting off parts of my RSS feed in the future, especially for technical articles, and surely for articles containing Esss Eeee Ohhh.
Dave Doolin´s last blog ..Technical Tuesday: Another Look at WordPress register_activation_hook
Thanks for this tip, Dave. Honestly, very informative. I’m very busy this week, I hope I can migrate this month…
Cebu Tech Blogger´s last blog ..Infolinks Lowest Payment for Paypal and Payoner Users
Nice! I’m getting over a cold myself.
Are you going to add to this over time? There have been a few things that I have thought would be much better as a plugin than as me going in and hard coding it into my theme. I should probably have a general proficiency with this.
Deacon´s last blog ..Mind, Body, Heart – In Revolt!
I have 2-3 dozen articles worth of material on plugins, but that’s way too much for the audience here. I like posting on this topic, but these articles get too little short term traffic, too risky.
On the other hand, long term, these articles suck down SERPs like an industrial vac. (And they provide me credibility with people who actually know WTF is going on.)
So I balance alienating short term readers with long term search results.
As for you point about plugins versus coding it into your theme, that particular article (or suite of articles) is Weekender newsletter list only. Actually, it’s going to be members only (hint hint hint), but as a Weekender, you get grandfathered in as I promised back in March (?) last year.
Dave Doolin´s last blog ..Saturday Morning Surfing: Programming Is “Actionary” Blogging Is “Reactionary”
Thank you for this! I have had “figure out how to build my own plugins” in my TODO list for months now – I’ll be following this closely.
It works, too:
http://skitch.com/rickybuchanan/n3ra5/minimal-plugin
tada!!
Ricky Buchanan´s last blog ..Dictation For Your iPhone/iPod Touch
Sweet! You’re the first linked.
Early April I’ll have more beginning plugin programming articles.
Dave Doolin´s last blog ..iPhone Blogging – Writing is so last millennium (& the Last Week in Review)
Comments on this entry are closed.
{ 1 trackback }