Wordpress Best Practices

Wordpress is an incredible example of what open-source software can be and it powers a vast amount of websites on the internet. Wordpress may be on your mind when deciding which platform to build your next site on. Please consider the things in this guide with your site ideas to get a feel for the mileage you can expect when you deploy on Wordpress.

I’ve been developing on Wordpress for almost 4 years and I’ve seen the good and bad parts. I’ve seen sites that should use Wordpress and I’ve seen sites that are a monstrosity to maintain. I’ve worked with several other great content management systems, and I see several others rising up and they’re priced great for what they are. If you’re choosing Wordpress for your website against your needs, based on price, I highly recommend you reconsider.

My goal is to share some Wordpress best-practices I’ve learned from an objective, site-as-a-whole view. There aren’t any code related tips or practices here.

What Wordpress is

  • Free
    Wordpress is, always has been, and will remain Open Source software.

  • A blogging platform
    It started as a blogging platform and that remains its strength.

  • A light CMS
    Since it was first released, people have gotten creative trying to use Wordpress for everything. The developers caught this and have made the software a bit kinder to this audience by adding custom post types, a menus tool, and some new templates.

  • User Friendly
    Wordpress’ admin UI tops some of the paid CMS options!

  • Easy to deploy with and on
    Installation can be performed in 5 minutes and themes can be deployed very easily via the filesystem.

  • Secure, when needed
    Wordpress is such a popular platform, security experts do keep an eye on the internals and security is taken very seriously.

  • Actively maintained and updated
    Not only is it updated on a good schedule, but Wordpress has one of the best in-software update systems in self-hosted web software.

  • Quick to populate with content
    Your client (or you) can get all the content you have on Wordpress while the site is being developed.

  • Extendable (via Plugins library)
    There are thousands upon thousands of plugins in the directory. Not all of them are great, but there are some that are amazing. It’s also easy to build plugins yourself, if you find yourself repeating processes often in development.

  • Great for individuals, small groups, and small businesses
    I’m unsure about e-commerce sites, but if the site is mostly informational, it should work out

  • Great support communities all over the internet
    The Wordpress forums are great, but the StackExchange site is a godsend.

What Wordpress isn’t

  • Friendly for front-end developers
    Have you ever had to work with functions.php?

  • Fast (or optimized for performance)
    When the performance of a site relies on the theme itself (and plugins chosen), there’s only so much the Wordpress core engineers can do to make sure your specific install is running as fast as possible.

  • Ideal for larger organizations
    The type of organization needed for a large organizations site just doesn’t exist here, and shouldn’t have to - that’s not the point of Wordpress. There are plugins that can help with organization, but they’re still just that - plugins.

  • Entirely Bug-free
    Anybody who has built several sites on Wordpress has encountered annoying bugs that are for niche cases and aren’t a huge priority to be fixed.

  • Perfectly Consistent
    I’m Talking about some parts of the Admin UI, function interfaces, and there’s not always a nice, standardized way of doing things.

  • A platform for communities
    I wouldn’t recommend using the comments feature.

Ideal Environment

This is the part of this post I was most excited to write about. Wordpress is an resource expensive platform to run and that needs to be considered when choosing where to host. Wordpress builds every page from the database with a number of queries and this does take a fathomable amount of time.

You can definitely try to play it cheap and run your Wordpress site on a shared host, but I strongly recommend against that if you plan to see any load on your site in the future. I recently made the mistake of putting my sites on Mediatemple only to find that the database connection there was destroying my render times. They thought it would be cute to offer decent database service starting at $20 from what I already paid. This wasn’t ideal at all for even my personal site. I just decided the best way to go for Wordpress is a VPS hosted on something like Rackspace Cloud. You can just install all the server software yourself and expect much, much better load times.

Recently, I found myself in a Wordpress project where working on a global scale was a priority. Since VPS hosting puts your site on a single server, in one place in the world, I decided that an origin pull service on top of my hosting would be great help. I choose Cloudflare; because they were free, global, and offer a great deal for paid plans if you need better performance. This makes sure my VPS server isn’t wasting time on sending static resources that aren’t changing frequently. There are plenty of great alternatives to Cloudflare, like Cloudfront (close names, I know) and even S3 (which requires take more manual configuration)

Even with Cloudflare, the pages still need to be rendered for every view, so something that would render pages once and keep them for a little while would free the server up a tiny bit. Your content probably isn’t changing so fast that caching pages would be a bad thing. A plugin like W3 Total Cache helps nicely, by allowing for multiple types of caching in the backend of Wordpress. It will make a difference with page load times, and won’t let your server bog up as much when traffic comes in heavily.

You may think “oh! that sounds expensive!” It’s not. I pay about $16 a month for all of this.

So what’s the ideal environment for Wordpress?

  • Dedicated Hosting of some sort
  • CDN for all static resources
  • Comprehensive Wordpress caching plugin

Content Management

Wordpress is great for organizing two types of content, to start: pages and posts. Many small pages can be broken down into these very nicely. Since Wordpress category support is good, the posts content type can handle multiple “blog” like feeds, and the pages can be organized in a hierarchy.

If what you’re looking for is more complex, stop right there. Wordpress isn’t for you. Custom post types do exist, but I highly recommend staying away from them. Custom post types are tied in with the current theme, which is poor MVC practice. Data will be lost if you export your blog and don’t bring in the other theme. This is a worse case scenario, but it can be avoided!

Start early with figuring out how to organize content. A list of categories that will be organize your site should be decided on. Tags are nice for indexing things, but as far as making a site easier to organize, aren’t the best tool. Try out your desired site structure in the menus builder. If you end up needing multiple menus based on where the user is, you’ve probably crossed the Wordpress complexity barrier.

Wordpress has awesome permalinks support. I usually work with %category%/%postname%, which is a professional way to handle URLs. A good permalink structure that links your posts with pages will help the users make sense of your organization.

Handling content management -

  • Start early with organizing categories for posts and heirachy for pages.
  • Try out the site structure in the menus builder. Make sure it works and isn’t too complex!
  • Figure out a nice permalink structure.

Theme Development

Wordpress theme development is a hack. It is! When you’re building a theme in Wordpress, you’re throwing together logic for views and for models, sometimes in the same file!

Themes are nice for building sites out, but in the end, they’re still just that - themes. I’ve always been weary of putting too many site specific things into a “theme.” It feels dirty. What if the client accidentally changes the theme? A lot of the sites functionality can be lost. Use the built-in features of Wordpress to do as much as you possibly can before relying on your own code to perform important tasks (example: the built in tags and excerpt feature can be used in the meta description and keyword tags for SEO).

Themes are the biggest potential performance bottleneck in a Wordpress related site. The theme developer has to consciously make decisions to keep the database query count down. Using lots of plugins also can harm performance, and these should be considered with theme development. It’s better to load RESTful APIs over JSON than to load them with PHP for every request. Cache variables that will be reused often, like bloginfo().

If you’re a front-end developer, this is where I encourage you to speak up about the CMS selected to build the website. All of the functionality they’re looking for in their site has to be built into this theme, oftentimes overriding the default way Wordpress does things. If Wordpress is chosen, make sure to look at the plans for the site to see if anything conflicts how Wordpress works. If there are many per-URL logic statements needed, if you’re going to need to build many templates for pages, or if the client is really set on custom post types, Wordpress is probably not the best direction.

Handling Theme Development -

  • Try to use the built in features of Wordpress whenever possible to avoid relying on theme logic code.
  • Make sure to think about database performance when building a theme.
  • See if the site is going to need features or workflows that go against Wordpress’ flow of things.

Alternatives

Here are a few CMS alternatives to consider. They each serve their own purpose well and deserve a look.

  • Anchor CMS - A light and simple CMS for artsy blogs.
  • Craft - Up-and-coming CMS with a ton of potential.
  • Expressionengine - Great for giant and complex websites
  • Statamic - Database-less CMS, works nicely for personal sites.
  • Jekyll - Static Site Generator, can host things on S3 cheaply.

Conclusions

Your time is valuable. Wordpress is still a great platform and if you get the chance, you should make something on it. Make sure to take an objective look at the project and see if Wordpress is the right fit. If you’re rejecting other platforms because you don’t know them, you’re hurting yourself and your clients, because other platforms have Wordpress’ ease, but help you out when the content and organization of the website gets complex.