WordPress 4.4, a Developer’s Release

Introduction

WordPress 4.4 became available earlier this month. As is the pattern, these seemingly point releases are in fact major releases for the platform with notable changes. An actual point release, 4.4.1, is already in the works.

There are numerous notable additions and changes in this release. I’m going to point out a number of interest to me, and likely, to others as well.

The Additions

REST API Infrastructure

WordPress has for quite some time had the XMLRPC API, which has been considered clunky and less useful than it could be. API-based development has been on the rise in recent years, and a RESTful API has long been in the works for the WordPress core.

4.4 marks the integration of the API infrastructure into core. API endpoints are for now provided through a feature plugin; standard endpoints are expected to be part of core in WP 4.5. The plugin is under active development on GitHub, and can be installed though the official plugin repository.

Details:

Term Meta

WordPress has supported custom content types for some time, and custom fields for even longer. Along with custom content types came the ability to create custom taxonomies, useful for classifying content in much more useful and flexible terms than tags or categories. Unfortunately taxonomy terms have not been able to have associated metadata or custom fields. This has been worked around in numerous incompatible ways, but like the REST API, the WordPress team have for quite a while unraveling this problem.

Core now supports the addition of metadata to taxonomy terms, which will allow them to become more useful again, and not just for classifying content.

The WP_Term object was added, along with related functions:

  • add_term_meta()
  • get_term_meta()
  • update_term_meta()

Details:

Taxonomy and Post Type Labels

New labels added for filling when registering post types and taxonomies.

New custom post type labels:

  • filter_items_list
  • items_list_navigation
  • items_list

New custom taxonomy labels:

  • items_list_navigation
  • items_list

Details:

Responsive Images

Responsive images have been an ongoing topic for several years as part of the larger responsive design movement. There has unfortunately been no core means in WordPress of handling responsive images. This has landed in core due to, once again, a feature plugin being developed and matured to the point it could be integrated.

Several functions available:

  • wp_get_attachment_image_srcset()
  • wp_calculate_image_srcset()
  • wp_get_attachment_image_sizes()
  • wp_calculate_image_sizes()
  • wp_make_content_images_responsive()
  • wp_image_add_srcset_and_sizes()

New default image size, medium_large.

Can customize responsive image markup.

Details:

Comment Object

Following the trend of adding object-oriented code to supplement (or perhaps eventually supplant) global functions, two new classes have been introduced for managing comments and querying comments. These classes are:

  • WP_Comment
  • WP_Comment_Query

Details:

Document Title

WordPress 4.1 added a new mechanism for generating content titles. 4.4 was going to deprecate the old way of doing so, but a late change reversed that – the old way still works, but is not recommended.

Now there is no need for including wp_title() in the header.php template – the title will be generated via the wp_head() action. There are hooks available to control how the title gets generated.

The new functionality is enabled through a switch in the theme’s functions.php file:

add_theme_support('title-tag');

That goes in a function hooked to the after_setup_theme action.

Details:

Embeds

Another longstanding capability has been the embedding of external content into WordPress content. This includes but isn’t limited to Twitter updates, Facebook posts, and Youtube videos. Core can now handle embedding comments from Reddit and presentations from Speaker Deck. Amusingly, WordPress can now also embed other WordPress content. Simply paste the relevant URL and WordPress does the rest.

Twenty Sixteen

Since 2010 the WordPress community gains a theme named for the year, which is included with immediate major version of WordPress as well as from the theme repository. In keeping with the pattern, 4.4 debuted alongside a new yearly theme, Twenty Sixteen.

As with previous yearly themes, Twenty Sixteen doesn’t push the envelope with the latest web technologies. Rather, it is a reference implementation of current WordPress best practices and new and updated features.

Twenty Sixteen is undergoing continued development on GitHub.

Details:

Conclusion

Some WordPress major releases bring substantial visual changes. In my view, this isn’t one of them. Aside from some certain features, such as embeds and native responsive images, I consider 4.4 to be a developer’s release, where new and updated capabilities enable or smooth certain aspects of building themes or plugins for the WordPress platform. I’m particularly interested in trying out term meta and experimenting with the new REST API underpinnings.

Further Reading