How Not to Write a WordPress Plugin
Don’t you just love documentation that seems to skip the important parts?
Sometimes it will be a tiny, single line that is vitally important, yet whoever wrote the documentation managed to omit that part, assuming you knew it should be there, completely forgetting that they are writing for someone who is new to all of it and doesn’t know that important stuff because if the person did know what they needed to do, that person probably wouldn’t need the documentation telling them how to get started.
Other times, the documentation author goes into great detail about the lesser important things, and skips over the really big stuff you need to know.
For example, the documentation for writing a WordPress plugin goes into great detail at the beginning. Here is the “Standard Plugin Information”:
<?php
/*
Plugin Name: Name Of The Plugin
Plugin URI: http://URI_Of_Page_Describing_Plugin_and_Updates
Description: A brief description of the plugin.
Version: The plugin's Version Number, e.g.: 1.0
Author: Name Of The Plugin Author
Author URI: http://URI_Of_The_Plugin_Author
*/
?>
See, we’re off to a great start. Next, here is the license information you ought to include:
<?php
/* Copyright YEAR PLUGIN_AUTHOR_NAME (email : PLUGIN AUTHOR EMAIL)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
?>
Excellent! Now, we can finally get into writing our code and make our plugin do what we want! Hooray!
Except, that’s where things come to a screeching halt. All detail ends. Any hope of continuing a step-by-step process of writing your plugin, even on writing a very basic plugin, even just showing a basic template of how to lay out your plugin, is completely shattered. Oh, you get more details on different functions, an API reference that shows you all the cool things you could do if you knew how to write a plugin and, at the very end, they’ll even help you out with suggestions for different plugins you could write.
You could write them, of course, if you had any idea of how to write the plugin, which doesn’t seem likely to be found there. It’s like, ha ha!, you could write these plugins if we had shown you how to write a plugin, but we didn’t, so in your face and up your nose with a rubber hose, we ain’t showin’ you nuthin’!
Oh, so you go to third party tutorials, which seem to skip over important bits, since when you try to run the example code, nothing whatsoever happens, not even the incredibly lame thing that the example plugin was supposed to do.
Alternatively, you can take apart other existing plugins to try to figure out how they work, but then you just end up scratching your head wondering why a fatal error occurs when you load the plugin and then why, once you’ve resolved that particular issue, nothing in particular happens at all.
So, if I ever manage to write a working plugin, I will try to put together a tutorial on writing a plugin. A tutorial that will actually show you how to create a working plugin, not some sadistic attempt by someone to force you to learn by failing again and again and again using crummy code that doesn’t work, but you should figure out why it doesn’t work, but who needs that kind of stress when you’re trying to learn something and it’s not entirely easy or efficient to learn something by trying to find what’s wrong when you have absolutely no idea of what could be wrong because you haven’t learned a thing about it yet. No, I will put together a functional tutorial so you don’t have to bang your head against the wall in utter frustration over trying to do something that, on the surface, would seem to be pretty straightforward and relatively easy to do.
Perhaps writing a WordPress plugin is one of those closely guarded secrets no one wants to let you in on, so you won’t go about writing your own plugins. Well, if I figure out that secret, I will share it with you so you can start writing your own plugins too. Power to the people!
Optionally, if I manage to find a good tutorial that covers the aforementioned, I’ll just share that link with you. No sense reinventing the wheel.



That’s the problem with pure coders. They can’t see beyond the little box they’re in and realize that non-coders might want to try writing a plugin. Of course this is a sweeping generalization, but it applies to many I’ve met.
Good luck with the plugin - I’m happy to see you are undeterred.
The Hot Blogs! list in the sidebar is currently powered by my plugin! You can see the details in the post I just posted.
[...] The Millionaire MindOffering the Keys to Real Wealth Today.www.TheMillionaireMind.netStart Selling Online NowFind wholesale suppliers and dropshippers. Sell on your website, blog or auctions.www.SaleHoo.comMake Money with SurveysYes, honest participants can earn extra money with online surveys!www.SurveyScout.comAds by P-S Ads « How Not to Write a WordPress Plugin [...]