WordPress 5.2 Field Guide

WordPress 5.2 is officially the best WordPress 2019 has seen that rhymes with wp_nav_menu()! Users will see new coreCore Core is the set of software required to run WordPress. The Core Development Team builds WordPress. blocks available, and an added ability to enable or disable blocks within the blockBlock Block is the abstract term used to describe units of markup that, composed together, form the content or layout of a webpage using the WordPress editor. The idea combines concepts of what in the past may have achieved with shortcodes, custom HTML, and embed discovery into a single consistent API and user experience. inserter, along with a multitude of other block editor updates.

There are also new features to protect sites from the dreaded “White Screen of Death“, a new area for users to view, copy, and share important debug information, improvements to AccessibilityAccessibility Accessibility (commonly shortened to a11y) refers to the design of products, devices, services, or environments for people with disabilities. The concept of accessible design ensures both “direct access” (i.e. unassisted) and “indirect access” meaning compatibility with a person’s assistive technology (for example, computer screen readers). (https://en.wikipedia.org/wiki/Accessibility) and theming Privacy Policy pages. Developers will love the various new filters and functions, and will also be able to take advantage of 62 enhancements and feature requests, 228 bugbug A bug is an error or unexpected result. Performance improvements, code optimization, and are considered enhancements, not defects. After feature freeze, only bugs are dealt with, with regressions (adverse changes from the previous version) being the highest priority. fixes, and more! Let’s look at the many improvements coming in 5.2…

Site Health and WSOD Protections

WordPress 5.2 includes portions of the Site Health and Servehappy projects. A new Site Health page nested under the “Tools” menu will run a series of tests on a site pointing out potential issues that site owner should be aware of. Plugins and themes may add their own tests, or modify/remove existing ones using filters. More debugging and support information is displayed within an “Info” tab in the same area of the adminadmin (and super admin). This information can help developers troubleshoot user issues.

From the Servehappy project comes the addition that allows administrators to fix or mitigate fatal errors on their site that would previously have been impossible to address without developer interference and modifying the codebase. This includes five ways that developers can integrate with the new recovery mode features.

Block Editor

The block editor has continued its rapid iteration since WordPress 5.0, and now has GutenbergGutenberg The Gutenberg project is the new Editor Interface for WordPress. The editor improves the process and experience of creating new content, making writing rich content much simpler. It uses ‘blocks’ to add richness rather than shortcodes, custom HTML etc. https://wordpress.org/gutenberg/ version 5.4 bundled with WordPress 5.2. The most significant change in core is the addition of a a reusable block-editor module to expand the usage of the Block Editor in a context independent from the post editor without any dependency to the post object (e.g., to other WordPress admin pages like the widgets screen).

A new asynchronous mode for block rendering has also been added, new RSS and Amazon Kindle embed blocks were added, and a block management modal with the ability to enable/disable blocks from the block inserter. Improvements to the end-to-end tests have been made (including support for aXe Accessibility testing), as well as improvements to the accuracy of WP_Screen::is_block_editor(). Core blocks (aside from the Classic block) are also no longer using TinyMCE under the hood.

Accessibility

Accessibility updates in 5.2 include improvements to markup for Admin tabs, to post formats in list tables, to Admin Bar submenu link markup, and to the Archive WidgetWidget A WordPress Widget is a small block that performs a specific function. You can add these widgets in sidebars also known as widget-ready areas on your web page. WordPress widgets were originally created to provide a simple and easy-to-use way of giving design and structure control of the WordPress theme to the user. dropdown all to help assistive technologies.

Privacy Policy and Data Exports

The Privacy component has been enhanced with the addition of four new features to make customizing and designing the Privacy Policy page easier. Tag restrictions for User Data Exports have also been relaxed.

Note the shim provided for plugins and themes wanting to support the is_privacy_policy() function in older versions of WordPress

Security

5.2 includes several security-related updates like protection against supply-chain attacks and modern cryptography for WordPress plugins; read below for details and examples.

Other Developer Updates

There are even more goodies in 5.2 like the addition of 13 Dashicons and the WOFF 2.0 file format, the addition of short circuit filters to WP_Site_Query and WP_Network_Query, the addition of the wp_body_open() function to trigger a wp_body_open action, the addition of the category_list_link_attributes filterFilter Filters are one of the two types of Hooks https://codex.wordpress.org/Plugin_API/Hooks. They provide a way for functions to modify data of other functions. They are the counterpart to Actions. Unlike Actions, filters are meant to work in an isolated manner, and should never have side effects such as affecting global variables and output. to Walker_Category, the addition of the users_have_additional_content filter, the update to @wordpress/scripts package to include webpack and Babel configurations, and more!

Note the wp-includes/fonts/dashicons.woff file does NOT include the 13 new icons.
Note the shim provided for themes wanting to utilize the wp_body_open() function in older versions of WordPress and prevent fatal errors from the undefined function

But Wait, There is More!

Over 228 bugs, 59 enhancements, 3 feature requests, and 16 blessed tasks have been marked as fixed in WordPress 5.2. Some additional ones to highlight include:

  • Embeds: YouTube embeds lack title attribute (#40245)
  • Export: Issue with WP Export – adding spaces to .xml file (#46575)
  • Feeds: Feeds now respect the Last-Modified headers (#4575)
  • General: Add sodium_compat — a libsodium-compatible cryptography APIAPI An API or Application Programming Interface is a software intermediary that allows programs to interact with each other and share data in limited, clearly defined ways. for PHPPHP The web scripting language in which WordPress is primarily architected. WordPress requires PHP 5.6.20 or higher <7.2 (#45806)
  • I18Ni18n Internationalization, or the act of writing and preparing code to be fully translatable into other languages. Also see localization. Often written with a lowercase i so it is not confused with a lowercase L or the numeral 1. Often an acquired skill.: The Personal Data Erasure Fulfillment email is now in the Users LocaleLocale A locale is a combination of language and regional dialect. Usually locales correspond to countries, as is the case with Portuguese (Portugal) and Portuguese (Brazil). Other examples of locales include Canadian English and U.S. English. (#44721)
  • I18N: The Personal Data Export email is now in the Users Locale (#46056)
  • Networks and Sites: Introduces the ms_user_list_site_class filter (#41146)
  • Networks and Sites: Introduces the populate_site_meta filter (#46437)
  • Privacy: The ‘Download Personal Data’ admin action no longer triggers a completion of the request (#44644)
  • Privacy: Users are now able to make additional requests when identical previous requests are in a complete or archived state (#44707)
  • Privacy: Remove the Privacy Pointer (#45999)
  • Privacy: The Privacy Policy guide help notice is now displayed on both the classic editor and the block editor (#46098)
  • Privacy: Remove the Privacy Bubble (#46819)
  • Themes: Add global action to get_template_part (#41575)

Please, test your code. Fixing issues helps you and helps millions of WordPress sites.

Props to @desrosj and @earnjam for contributing to this guide.

UPDATE on 7 May 2019: Added “Changes to post globals setup and usage in get_the_content() and related functions in WordPress 5.2″ dev notedev note Each important change in WordPress Core is documented in a developers note, (usually called dev note). Good dev notes generally include a description of the change, the decision that led to this change, and a description of how developers are supposed to work with that change. Dev notes are published on Make/Core blog during the beta phase of WordPress release cycle. Publishing dev notes is particularly important when plugin/theme authors and WordPress developers need to be aware of those changes.In general, all dev notes are compiled into a Field Guide at the beginning of the release candidate phase. to the Other Developer Updates section.

UPDATE #2 on 17 May 2019: Added “Security in 5.2” dev note to the newly created Security section.

#5-2, #field-guide