Interested in developing your first WordPress plugin?
If you’re new to WordPress development and you want to join in the fun of our great WordPress development community, this is the episode for you! Join us as we kick off part 1 of WordPress plugin development on the FreshDev web show!
FreshDev: Part 1 of WordPress plugin development
WordPress plugin basics
So you’ve got your big idea for a new plugin and you’re ready to rock.
Before you start coding, let’s cover the basics!
Research the idea
So who is your friend here?
Google and the WordPress repository. These are two great places to start to research your new plugin idea. With just over twenty-five thousand plugins in the repo (as of this writing) there might be someone doing what you’re setting out to do.
- Does it exist?
- Is it current?
- Does it lack some significant unique function?
If the answer’s are “Yes” — perhaps you’re on the right path. If there’s something similar, try reaching out to the original author and see if you can contribute. This is what makes WordPress community great!
Get your canvas ready
Code is poetry.
The plugin you’re about to code is a work of art. So get your workspace, dev environment and mind ready. We’ve recently outlined this process on FreshDev, see Getting Started with WordPress on a Local Host.
- Localhost – Very common for folks to develop locally on their computer or LAN
- Remote host – Additionally you might have a remove server you pay for for testing and putting your code through it’s “real life” paces.
- GitHub – Consider this a social network of code. Get familiar with GitHub here.
There’s host of other other options for your development environment, we’re just trying to get the creative juices flowing.
Name your plugin
Back to the research thing.
What are you going to call it? Think about SEO for a bit — what’s a quick easy name folks will remember and doesn’t have a lot of similar search results. Does it convey what your plugin is all about?
Licensing your plugin
To make our series a bit shorter, we’re not spending too much time on licensing. Although you should know it’s very important.
For the examples provided, we’re guessing you want to put your plugin on the WordPress repo and will comply the GPL2 license like the majority of WordPress authors.
Other tips, tricks and tactics throughout part 1 of WordPress plugin development:
- Follow the WordPress coding standards
- Functions need to be prefixed, unless you’re creating a PHP class file
- Optimize database calls
- Use WordPress APIs instead of writing your own functions (i.e. database queries)
- Eliminate PHP errors and warnings within your plugin – (see our review of Debug Bar vs BlackBox Debug Bar: WordPress Plugins)
Oh there’s plenty more, but we will cover that in part 2!
What did you think about part 1?
Obviously, I play the role of the guy who’s learning (maybe because I am) plugin development for the first time. But we want to hear from you — useful and entertaining? Nothing of the sort? Chime in!