
Photo by Damian Zaleski on Unsplash
But to get a theme into the WordPress Theme Repository, developers have to follow some strict guidelines. Some of the guidelines are commonsense coding best practices, but others are specific to the WordPress project and are made clear in the Theme Review Requirements document and the documentation for the Theme Check Plugin.
But some developers either aren’t aware of the rules or choose not to follow them. In a recent blog article, Carolina Nymark discussed the reasons some themes are rejected. Many rejections could have been avoided with a better understanding of the guidelines, so I’d like to have a look at five common mistakes WordPress theme developers should avoid if they want a smooth voyage into the WordPress Theme Repository.
Missing Escape Or Using The Wrong Function
Forgetting to escape user input is a common problem, and one that can have disastrous results for security. Cross-site scripting attacks are the number one security risk on the web, and failure to properly escape input causes cross-site scripting vulnerabilities.
The WordPress Theme Handbook gives clear guidance about which functions should be used and which shouldn’t, so it’s well worth spending a few hours familiarizing yourself with it before embarking on theme development.
Text That Isn’t Translation Ready
WordPress is used by hundreds of millions of people in almost every country in the world. That’s a huge number of languages that have to be supported. WordPress provides plenty of tools and guidance for internationalization, so there’s really no good reason a theme shouldn’t be translation ready.
Scripts Or Styles Not Enqueued
WordPress provides functions for adding JavaScript and CSS files to themes. It’s better to use these functions than to load the files using other mechanisms.
The typical WordPress site has a theme and many plugins, all of which might load JavaScript and CSS files. The enqueue functions make sure that everything works well together and that there are no compatibility problems.
PHP Notices, Errors, Or Warnings
This one isn’t too complex: if your PHP code throws errors or warnings, you’re unlikely to be approved to join the WordPress Theme Repository.
Duplicate Theme
Some developers submit themes that are already in the repository. As I said at the top of this post, getting a theme in the repository is good for a WordPress developer’s career, so there’s an incentive to pass off another developer’s work as your own. But copied themes will be found and rejected immediately.
All of this is straightforward stuff for experienced WordPress developers, but if you’re new to theme development, taking a close look at some of the theme development resources we’ve linked to here would be a fruitful use of your time.