If you’ve decided to join the community of WordPress developers, you are at a big advantage compared to someone like you five years ago. There is a lot of information all over the Internet, tons of useful tutorials and great web hosting firms who can assist you on the technical side. You can get on your feet in no time. Admittedly, this can feel a bit overwhelming to a newcomer who’s not sure where to even begin, so keep the following few points in mind when beginning your journey.

  • Don’t reinvent the wheel

Many times, some key functionality you need in your project will have already been implemented by someone else. It doesn’t have to match your requirements perfectly, but if you can find a library that does at least some part of your needed task, this can shave off a large chunk of development time and allow you to focus on the main features of your plugin. Don’t feel bad about reusing other people’s work, either – as long as it’s provided with an appropriate license, it’s fair game, and you’re actually expected to combine different building blocks like that when making a complex plugin. And that brings us to our next point…

  • Invest in valuable tools

So you can’t find the right library or tool for free. The logical alternative is to write it yourself, right? Wrong. That’s the case most of the time anyway – if the resource exists but costs money, you should calculate whether it’s even worth your time to implement it on your own.

After all, your own development time is a resource like any other, and if you put a price on it, it may often turn out that spending $50 or so on the right tool will be significantly cheaper than spending the corresponding amount of time to do it yourself. And on top of that, you get the benefit of knowing that someone else is entirely responsible for supporting and maintaining that part of the project, so at least that’s one less problem on your shoulders.

  • Keep a consistent naming scheme

Group all your functions and variables under a common naming scheme, the most common approach is to use a prefix in front of everything. This accomplishes two things: first, it makes your code much easier to manage when integrating it in other parts of WordPress. If you’ve spent a lot of time on your plugin and it includes a large number of functions, you don’t have to keep wondering which of them came from you and which are calls to some core WP functionality… or functions from another library altogether.

The second benefit is that it makes your plugins easily compatible with others, as there is no risk of a name conflict between functions and variables. For example, a function called copy_data() can probably be found in more than one plugins out there, but if you name it YourPlugin_copy_data(), this keeps you in the safe zone.

  • Caching is your friend

Don’t keep dynamically reloading resources that the user has already requested, and optimize your use of complex data structures with caching as much as you can. Your code should generate as little as possible on the fly, and it should always attempt to load data from some cache. WordPress itself has some great built-in functionality for that, so make extensive use of it in your plugins.

  • Don’t abuse the database

If writing a plugin that requires database functionality and you’re not experienced with databases, be careful with the queries you write. SQL can make it very simple to retrieve complex data sets with relatively short queries, but you must also consider what happens in the background when you execute a query like that. If you keep running complex queries against your database on a regular basis just to retrieve a few small bits of data, you’ll waste a lot of processing power on the server for nothing.

If you still need to work with complex queries and want to make sure that you’re not doing anything wrong that places unnecessary strain on the system, it may be a good idea to team up with someone who can do this for you, especially if it’s a critical part of your plugin’s design.

Leave a Reply

Your email address will not be published. Required fields are marked *