During this week’s WordPress Theme Review Team meeting, members considered the possibility of allowing themes hosted in the directory to make use of the WP REST API plugin. Since the API is not yet included in core, any theme or plugin author who wants to use it must have the feature plugin installed.
Ordinarily, WordPress.org themes are not allowed to require a plugin on installation (although they can suggest one). As per the Theme Review Handbook on plugins: A theme can recommend plugins but not include those plugins in the theme code.
“The core team has asked us to consider temporarily allowing the requirement of the REST API for themes that may take advantage of it,” Tammie Lister said before calling for a vote. She also noted that waiving the rule would be temporary, as the API will soon be going into core.
“This does not open up the way for others as an exception because it’s a core feature,” she said.
The team took a quick vote and all present unanimously agreed to allow themes to require the REST API plugin as a temporary measure until it is available in core. Check out the meeting logs for the full discussion.
The WP REST API is already being used in production in many different ways around the web, as revealed in the comments on project leader Ryan McCue’s recent post calling for examples. If the Theme Review Team wants to keep pace with where WordPress is headed, it must offer the flexibility to allow for more innovative themes. Temporarily waiving the guideline against plugin requirements is a smart move.
As WordPress.org accrues more examples of themes that use the REST API in a way that complies with the review team’s high standards, developers who are just getting started will have strong examples for creating their own. Jack Lenox’s presentation at WordCamp London this year highlighted a few of the benefits of theming with the REST API:
- Provides a way to retrieve pure data (usually in JSON or XML format) over HTTP
- No loops necessary
- Good for mobile apps and environments where you don’t want a full webpage to render but want content from a blog or site
With the official directory now welcoming these types of themes, it won’t be long before the entire landscape of WordPress theme development changes to support more modern ways of presenting content. Check out Jack Lenox’s presentation on Building themes with the WP REST API for information on how to get started.