Here’s a little gem on conditional statements that I saw for the first time in the WordPress Coding Standards a few months ago. When writing out a conditional logic, it is recommended to place the variable on the right side of the comparison operator and the constants or literals on the left. Appropriately named “Yoda Conditions”, as the statement then reads backwards to how we would typically speak or think. I’ve never really thought about this before but it really is a handy little tip.
As of version 2.6, WordPress introduced a feature which autosaves your posts as revisions while you are editing them in the dashboard. While this functionality can be very useful, it can also be a bit of an annoyance. If a single post ends up going through multiple edits or simply takes a while to get finished, those revisions can add up. I personally don’t see the need to have billions upon billions (ok, slight exaggeration) of revisions saved for every one of my posts. Additionally, that is just extra information that is getting stored in your database, which you may not need. Disabling this feature or limiting the amount of allowed revisions (which is what I opted for) is actually quite simple. It only takes one line of code in your