Category: Coding Standards

Plugin Development 101 – Separating Your Plugin into Multiple Files | Pippins Plugins

In part 3 we discussed the general best practice of separating your plugin out into multiple files. Today we’re going to look at how you actually do that and also go into more depth about why this is a good practice that you should be adopting for all of your plugins once they begin to become even remotely complex.

Read more ›

The WordPress Coding Standards: The Ternary Operator and Yoda Conditions

In this particular article, I thought we’d take it a bit easier before jumping into the final topic. As such, we’re going to cover two really simple topics (that are often either ignored or overcomplicated).

Specifically, we’re going to talk about the ternary operator and we’re going to talk about Yoda conditions.

When it comes to writing WordPress-based code, the Coding Standards strictly say that we should aim for readability first.

Read more ›

The WordPress Coding Standards: Single Quotes and Double Quotes

In this series, we’re taking a look at the WordPress PHP Coding Standards in order further understand how quality WordPress code should be written.

Sure, all of this is documented in the WordPress Coding Standards and it’s a site that every WordPress developer should have bookmarked and on hand when working on a theme, a plugin, or an application; however, if you’re just getting into WordPress development, then it’s important to understand the rationale as to why the conventions are the way they are.

In this article, we’re going to be taking a look at the use of single quotes and double quotes specifically when dealing with strings.

Read more ›

Resources For Learning Git


Git is an extremely powerful and sophisticated system for distributed version control. Apart from offering a novel approach to source code management, Git offers a great deal of features. Sadly, learning how to use Git can be confusing for anyone, not just beginners. As a result, in this roundup, we have collected some of the best resources for learning Git to help you initially get started with Git, and then, eventually mastering it.

If you are looking for a quick resource to help you get started with Git, this one by Roger Dudler will prove really useful to you. It will help you setup Git as well as give you the ability to experiment with it. Definitely worth checking out!

Read more ›

The WordPress Coding Standards: An Introduction

But this raises the question: What’s the point of an API or formal coding standards if we’re simply going to ignore them?

We’ve written quite a bit about the WordPress APIs in previous articles, and we’ve touched on the WordPress Coding Standards, but we’ve never really taken a deep dive into the coding standards, understanding each aspect of them, and why they matter.

So in this series, we’re going to be doing just that.

Read more ›

Don’t do_shortcode


Shortcodes are pretty cool, and the do_shortcode function is pretty neat as it can parse and execute shortcode callbacks from arbitrary strings, but that function invokes a fairly large regex every time it is called.

That regex looks for all registered shortcodes within a string. For each match, it runs a replacement with a callback function, which also take the time to parse the shortcode attributes, before finally calling the actual callback function that’s been registered with add_shortcode.

Regular expressions are pretty fast in PHP, especially for short strings, but do we really have to have WordPress do all that extra work, when all we really intended was to call our shortcode callback function?

Read more ›

The WordPress Coding Standards: Naming Conventions and Function Arguments

In this series, we’re taking a deep dive into the WordPress Coding Standards – specifically, the PHP coding standards – in order to evangelize and understand how quality WordPress code should be written.

Despite the fact that this is documented within the WordPress Developer Handbook, I think there’s something to be said for understanding the rationale behind why some things are the way that they are.

Remember: Our ultimate goal is to make sure that we’re writing code that conforms to the coding standards so that we, along with other developers, are able to more easily read, understand, and maintain code for themes, plugins, and applications built on top of WordPress.

Read more ›

7 Deadly Sins of WordPress Development

There’s a lot of freedom in WordPress development to extend the platform to just about anything you could imagine. However, when you develop for WordPress you have to make sure your theme or plugin can play nice with other WordPress extensions. Coding in a vacuum is inexcusable and can cause you or someone else a lot of trouble down the road. Here are some of the major things to look out for:

1. Loading your own copy of jQuery is a great way to just ruin everything, 2. Not loading JS/CSS files properly, 3. Not escaping user input in SQL and not encoding user input on output, 4. Incorporating too many 3rd Party Services, 5. Expecting too much from shared hosting, 6. Using “admin” for a username with an insecure password, 7. Adding tons of plugin-type functionality to a theme’s functions.php.

Read more ›

Building a WordPress-Friendly API Wrapper: Foundations

When building a web site or web application, it’s a pretty common requirement that you might need to pull in data from third-party site or application. If that site or application has an API, this is an excellent way to obtain the data needed. So, let’s take a look at how to do this with WordPress.

Before we get into the nitty gritty, let’s make sure we’re all up to speed with a couple of things, starting with what an API is.

Read more ›

Plugin Developers – Use Uninstall.php Please


On January 7th, 2008 I published an article that brought up a subject not many in the community at the time knew about. At the time, I had only used WordPress for a little over 7 months. I decided to venture into the database WordPress was installed in and discovered several discrepancies such as information from plugins I had recently deactivated and deleted from my installation were still inside the database. It turned out that some plugins were leaving their data, settings, or tables behind. This was a big deal at the time because it was occurring without users ever being aware of the problem. The post generated a great discussion on how this problem could be solved and I highlighted some of the best responses in a follow-up post.

Read more ›