An open letter to WordPress devs about standardization

11 April 2018 devTalks

This piece was written by Stefan Cosma, Web Developer and Community Lead at Koding and also speaker at DevTalks on the Cloud stage. Enjoy the reading!

 

Dear WordPress dev community and Automattic,

I’ve been working with WordPress for the past 5+ years. In this time frame I have worked with a lot of stuff, from free crappy open source themes to high-end premium ones. I’ve built plugins, themes, you name it. In all my years as a developer, that uses WordPress as his main work platform, I’ve tried to standardize my workflow and the stuff that I use when I’m developing new things.

All this time, I came across some stuff that in my opinion should have a standard. These things obstruct the way a developer interacts with certain aspects of a theme and / or plugin from a development perspective.

For starters, I believe that every developer, that wants to build a theme and / or a plugin, needs to follow some strict guidelines or standards that should be either imposed by the community or by Automattic.

Standards

When I say guidelines I’m not referring to the ones here, these are guidelines on how to write and structure code.

I am referring to standards on how a theme is structured. For example, I am working with a theme that doesn’t belong to me, code wise, and I want to be able to export the options of that theme for either backup purposes or to use them with a different installation of that theme. Now, the problem arises, not every theme offers this ability. This is because there is no specific standard set for this and developers are either to busy to add this features or don’t know how to do it. This should be a must with every theme.

I know it’s hard to set a standard like this and I agree it’s bit far-fetched but maybe we can work something out. For example, the community (myself included) could establish an initiative that builds a theme options framework, that is the starting point for every theme developer. This should include the most basic things, like for example:

  • Export / import theme options
  • Naming conventions. Sections in the theme options should have the same name across all themes.
  • Same options names in the database.
  • etc…*

*I’ll add more to the list in the future

The second to last point, from the above list, is another thing that should be considered as an important standard.

The theme option name set in the database is different for every single theme. It’s very confusing when you’re working with different themes all the time. This should be a global thing set by WordPress itself. Something like “Hey, if you want to save your theme options, use this option name instead of your own naming conventions!”.
Why should this be a standard? Because when working with multiple themes and child themes you need to have a clear view of what’s saved in the database and the best way to this is by having the same name or prefix used for all themes.

I propose something along these lines:

Now this option name is clear and you know what to look for in the database when searching for theme options.

Conclusion

In the end, I’ll just say this, yes I am aware WordPress is an open source project and not everyone can conform to the same things because every developer has his / hers way of doing stuff, but keep in mind that standards are important. Standards are what got us here in the first place.

Theme developers, I’ll only say this, have other developers in mind when building something, not just the end user, because other developers are first and foremost users and if they can’t use your product properly then what’s the point of all this?!

Bonus

There are also some other things that need to be standardized in WordPress and apparently the community is already working on a initiative. Custom post types and taxonomies are also something that needs a standard, but I won’t talk more here, maybe in another article. In the meantime go ahead and checkout this article and this one for more info on the matter.

Until next time, code long and prosper!

Regards,

Another WordPress developer

Partners