WordPress contributor teams recently released Theme Sniffer and WP Theme Auditor, tools that help developers to create themes that adhere to coding and accessibility best practices.
There are thousands of free WordPress themes and thousands more premium themes. Some are excellent, and some are terrible, but most are somewhere in-between on the quality scale. Installing a theme that isn’t coded correctly can cause security or user experience problems, which is why the WordPress project is careful what it lets onto the theme repository.
However, the most diligent theme checkers can’t catch every problematic theme, so lower-quality themes sometimes make it through, especially on premium theme marketplaces that may not be as careful as the WordPress Repository team.
Developers don’t set out to make themes that cause problems. Most want to create a theme that is useful, beautiful, and secure. Problem themes are the result of less experienced developers who don’t understand what is required of a WordPress theme or don’t have the WordPress and PHP skills to create a theme that ticks all the boxes.
Poor-quality themes create a negative user experience, and that’s not good for the WordPress project, which wants interactions with WordPress to be as pleasant as possible. One way to achieve the goal of theme excellence is to provide high-quality documentation for developers. Another is to create tools to help developers spot issues and fix them before they become a problem to users.
Theme Sniffer was recently released by the Theme Review Team. It analyzes a theme’s code to see whether it adheres to WordPress coding conventions, a set of rules the WordPress project believes should be followed by anyone who develops a WordPress theme.
The rules say how PHP files should be indented, whether single or double quotes should be used, how database queries should be formatted, and more. This might seem trivial, but coding standards help developers to maintain consistency throughout their projects, provide guidance about how to handle certain coding dilemmas, and make it easier for developers to collaborate — something that is particularly important for open source projects.
Accessibility is a particular problem for WordPress themes. Many themes that appear to be well-made pose problems for users with accessibility issues because the developer doesn’t follow accessibility best practices.
WP Theme Auditor is an NPM tool that examines WordPress themes with the aXe API, which includes tests to make sure a theme doesn’t provide a negative experience to people who have accessibility issues, including people who use WordPress via the keyboard or a screen reader.
Theme Check is a plugin that automatically tests themes for compliance with the official theme review standards. This one is particularly important because theme reviewers use it before allowing themes onto the official WordPress theme repository. If your theme doesn’t pass these tests, it may be rejected.
We’ve discussed the Theme Check plugin before, so take a look at our earlier post for a more in-depth discussion.
Automated testing helps developers to find coding and design mistakes before they’re released into the wild. The tools we’ve discussed make it easier for developers to create themes that are delightful to use.