Many of the changes in the forthcoming WordPress 4.6 are developer-focused changes that take place under the hood. Please remember to test your plugins, themes, and sites with WordPress 4.6 before the release. An hour of testing today can save you days of anguish later.
Enhanced Meta Registration
register_meta() is getting some updates to enable greater flexibility and features in the future (such as inclusion in the Rest API). Until now,
register_meta() took four arguments. In WordPress 4.6, this will decrease to 3, with the third one being an array of arguments. When
register_meta() is used with the old signature in WordPress 4.6, it will continue to function but will now return false. Please read the initial post outlining why
register_meta() has been updated and the followup detailing further enhancements.
Persistent Comment Cache
Since WordPress 2.6, the comments API has purposefully not used a persistent cache. Over the past 20 releases, changes have been made to purge the problems from the comments API that caused this. If you have a plugin which modifies comment data directly please change them to make use of the various comment API functions or use
clean_comment_cache(). You can hit this changes announcement for more info.
New Object: WP_Post_Type
Rather than a standard object, there is now a
WP_Post_Type for each registered post type. Three functions and three actions have been changed to use this new object.
WP_Post_Type provides methods to handle post type supports, rewrite rules, meta boxes, hooks, and taxonomies.
🛫 Open Sans, 🛬 Native Fonts
With the continued evolution of system fonts allowing for all devices to have a beautiful looking admin, WordPress 4.6 updates the font stack. To keep your custom admin pages looking consistent with the rest of the WordPress admin, you are encouraged to audit your CSS. The new font stack is:
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
When using this font stack, it must be called using the
font-family property, and not the
font shorthand. This works around an issue in Microsoft Edge. Additionally, the only font weights used in core now are 400 for general text and 600 for heavier text.
updates handle has been refactored and updated to support plugins and themes. If you are dependent on that handle, make sure to read about the shiny updates changes.
Resource Hints is a rather new W3C specification that “defines the
prerender relationships of the HTML Link Element (
<link>)”. These can be used to assist the browser in the decision process of which origins it should connect to, and which resources it should fetch and preprocess to improve page performance.
In 4.6, WordPress adds an API to register and use resource hints. The relevant ticket is #34292.
Developers can use the
wp_resource_hints filter to add custom domains and URLs for
prerender. One needs to be careful to not add too many resource hints as they could quite easily negatively impact performance, especially on mobile.
WordPress 4.6 will introduce
WP_Term_Query. This new class brings parity between taxonomy term queries and WP’s other content type queries:
WP_User_Query. And – as in the case of posts, comments, and users – the
get_terms() function has been converted to a wrapper for the new
Everyone should be able to use WordPress in the language they want. WordPress 4.6 makes a number of changes to assist with internationalization and localization. Some of the highlights include:
- Just-in-time loading for translations. You do not have to call
load_theme_textdomain() anymore (if you distribute your theme/plugin via wordpress.org).
- Community translations are now favored over translations which are included in your theme/plugin.
- Localized jQuery UI datepicker.
- Support for comment number declension in
get_comments_number_text(). See #13651.
- Fallback for
TextDomain header field in
get_plugin_data(). See #36706.
- Updated list of continents and cities for the timezone selector. See #37554.
- Support for the German (Switzerland) locale in
remove_accents(). See #37076.
- Improved support for month name declension. See #36790.
WP_Widget was introduced in 2.8 the
unregister_widget() functions required the class name (string) of a
WP_Widget subclass to be supplied. As of 4.6 these functions also accept a class instance (object) of a
WP_Widget subclass as well. See #28216.
Two key benefits of allowing objects to be instantiated are:
- Widgets can now be instantiated and registered with constructor dependency injection.
- New widget types can now be added dynamically, such as adding a Recent Posts widget for each post type, per #35990.
New and Improved Customizer APIs
The customizer has four major changes in WordPress 4.6. The most prominent is a new collection of APIs for validation of setting values. Included in this new notifications API for the customizer.
Additional changes include some CSS cleanup. Custom controls that use part of the core UI and subclass
If your code uses the customizer, you are encouraged to review the changes.
Every time WordPress is loaded, it goes through the bootstrap or loading process. In WordPress 4.6, there will be a few changes to the process focused on making pieces available earlier. Many of these changes will have no effect whatsoever on the vast majority of WordPress sites. However, if you are the type that maintains your own
advanced-cache.php drop-in, host/run large profile sites, or work on tools that bootstrap WordPress is odd ways, you need to know about the following changes:
plugin.php earlier in
is_ssl() is now located in
ABSPATH can now be safely defined before WordPress is loaded
Multisite Focused Changes
This release, work continues on multisite with a focus on improved APIs and performance. Some highlights include:
WP_Network_Query classes to query sites and networks in a standardized way.
- Enhancements to
WP_Network objects including lazy-loading for site details.
- A new helper function
get_current_network_id() to find the current network’s ID.
wp_get_sites() has been deprecated.
get_networks() are the future.
External Library Updates
- Masonry was updated to version 3.3.2 from version 3.1.4.
- imagesLoaded was updated to version 3.2.0 from version 3.1.4.
- imagesLoaded can now be enqueued without Masonry being enqueued. For backward compatibility reasons, imagesLoaded remains a dependency for Masonry.
- MediaElement.js was updated to version 2.22.0 from version 2.18.1.
- TinyMCE was updated to version 4.4.1 from version 4.3.10.
- Backbone.js was updated to version 1.3.3 from 1.2.3.
Summaries for each of these updates and links to full changelogs are available.
But Wait! There’s More!
Over 280 bugs, 125 enhancements, 7 feature requests, and 18 blessed tasks have been marked as fixed in WordPress 4.6. Some additional ones include:
Please, test your code. Fixing issues now, before the release, helps you and helps millions of WordPress sites.