Building your own plugin for WordPress can be very rewarding.
The key to success is following the advice and tips from proven plugin writers, as the world is full of hacks that can hand you a broken WordPress site in a heartbeat.
Here are a few things to keep in mind as you venture out:
Fewer Features
You don’t need to build the mother-ship of all plugins. Tentblogger has proven this. I use a number of his plugins for clients, but not all of them. If they were all bundled into one, my sites would be left processing crap it doesn’t need.
Friends don’t let friends code bloat.
Find a feature you want, zero-in with laser focus, and execute!
Make It Pretty
Since you’re so focused in on your goal, chances are, it’s going to be a fairly small plugin. This is your chance to make every line of code a piece of art.
Make sure you’re using WordPress APIs properly, and while you’re at it, add i18n support (WP Help 0.2 shipped with support for Bulgarian, German, Spanish, Mexican Spanish, Macedonian, Dutch, Brazilian Portuguese, and Russian!)
Less UI, More Magic
Everyone loves a plugin that you flip-on, and it’s ready and running.
UI screens are generally where plugin authors make security mistakes. By skipping them, you make it much more likely that your plugin is secure.
Obviously, there are those plugins that may need configuration, but if you don’t need a UI, don’t do it.
Code for Tomorrow
Always look forward. I recently through some junk together, and I made sure to use WordPress’ updated and recommended way of doing things. This is the direction they are headed, and the chances of them phasing out the old way is likely.
Don’t use deprecated APIs. Plan features in future-forward ways. Implement it in such a way that a site that is using the plugin doesn’t break if the plugin suddenly goes away.
Old ways = Broken plugins.
Wear a Helmet
Play it safe.
Writing secure WordPress plugins isn’t hard. It just takes awareness. Take the time to do your research and code a plugin that will be an asset to its users, not a liability.
Security is the most important feature your plugin can offer. Don’t be lazy.
Learn from Pros
The previous points are from Mark Jaquith, a creditable source. This is someone you can trust. Be careful when you do an open Google search to answer questions. Learn those who have tried and tested experience.
For example, Tom McFarlin was recently featured on wptuts+. wptuts+ is a great, creditable resource. Tom hit a home run with a two part series on Writing Maintainable WordPress Widgets, and provides a solid widget boilerplate to get you started-off in the right direction.
Find some good, solid, reliable places to get your info. Be mindful and careful who you’re learning from, and also, be sure to check the date of the article and read some of the comments.
[via Mark on WordPress]
Speak your mind...