WordPress.org

WordPress Developer Blog

What’s new for developers? (November 2023)

WordPress 6.4 was successfully released on November 7, 2023, and is the last major release of the year. If you haven’t already done so, it’s better late than never to test your plugins and themes to make sure things are running smoothly.

The most important thing you should check out is the WordPress 6.4 Field Guide. It will walk you through all the major changes that you need to know about in the latest release.

Much of this edition of our monthly roundup will include changes that have already landed in WordPress 6.4. Read along if you’re still playing catch-up. You’ll also learn about some features that are still in development, so be sure to install and activate the latest version of the Gutenberg plugin to test them.

Highlights

Block renaming support for nearly every block

As of Gutenberg 16.9, you can rename nearly every block in WordPress in the UI. Custom block names are stored as metadata in the block markup, meaning they can also be ported to patterns and templates. By using this new feature, you can greatly improve the experience for users who might be editing your theme in the Site Editor.

There are a few special blocks where renaming is disabled:

  • core/block
  • core/template-part
  • core/pattern
  • core/navigation

Experimental form and input blocks

Gutenberg 16.9 introduced experimental core/form and core/form-input blocks. These could potentially be the foundation for plugins that need front-end form fields in the future. 

Gutenberg 17.0 added support for using the Group and Columns blocks inside the Form block.

The feature is highly experimental right now and is not ready for anything beyond basic testing. You can enable it via the Gutenberg > Experiments admin screen. Now is an ideal time for form plugin developers to begin testing this and getting involved with its development.

Data Views work continues

Work toward an overhauled admin design continues in the Gutenberg plugin, particularly around page management and Data Views. To test the latest changes, you must enable the New admin views option via the Gutenberg > Experiments admin screen.

Dozens of changes—too many to list in this post—have landed in the plugin in the past month. To check out the code changes, see the closed Data Views tickets in the Gutenberg repository.

The admin redesign will be a major change in user experience and will ultimately impact many plugins in a future WordPress release. These changes are not something you want to sleep on. It’s important to test early and often while providing feedback along the way.

Major changes

Attachment pages disabled for new installs

With the WordPress 6.4 release, attachment pages are disabled on new installations. I repeat: this is for new installations only.

The change adds a new database option named wp_attachment_pages_enabled, which is set to 0 for new installations and 1 for existing installations. You can filter this option via the option_{$option} or pre_option_{$option} filter hooks.

There is no UI option for reenabling attachment pages on the front end (except through the hidden wp-admin/options.php screen), but there is a plugin linked in the original Trac ticket for those who want them turned on for new installs. 

TEMPLATEPATH and STYLESHEET constants deprecated

While the TEMPLATEPATH and STYLESHEETPATH constants have long been discouraged for use by extenders, they were still in use in several places in core. WordPress 6.4 has now officially deprecated them.

This change should not affect themes in the directory because Theme Check blocks theme submissions if they use the constants. If you are using them in a theme outside of the directory or a plugin, you should switch to their function-based counterparts:

  • get_template_directory()
  • get_stylesheet_directory()

Plugins and tools

Move away from wordpress/element to React 

After a discussion that began in August 2023, contributors have made the move to use React directly instead of the @wordpress/element wrapper in Gutenberg 16.8. Several pieces of documentation have been updated to reflect this change.

Framework for post metadata revisions

A new framework for storing revisions of post metadata shipped with WordPress 6.4. The feature is opt-in, and you must set the revisions_enabled argument of register_post_meta() to enable it. There are also several action and filter hooks available to further customize how the revisions work.

New PluginPostExcerpt slot

Gutenberg 16.9 introduced a <PluginPostExcerpt /> slot. This new slot allows you to extend the Excerpt panel in the post editor to add custom components.

New Tabs component to replace TabPanel

A new <Tabs /> component was added to Gutenberg 16.9. It serves as a replacement for the existing <TabsPanel /> component and has three subcomponents:

  • Tabs.TabList
  • Tabs.Tab
  • Tabs.TabPanel

Create Block package introduces transformer property

The Create Block package now has a new transformer property. The change offloads customization to templates, providing nearly complete control over how they can be used to create plugins or blocks. 

Retrieve pagination data via getEntityRecords()

Since Gutenberg 16.9, getEntityRecords() returns the total items and pages whenever you call it. They are stored as the totalItems and totalPages properties. This data is also automatically available through the useEntityRecords() hook.

New Filesystem API hooks

The Filesystem API in WordPress 6.4 has two new filter hooks that fire during the process of unzipping an archive:

  • pre_unzip_file lets you short-circuit the procedure and run a custom process.
  • unzip_file runs over the result of unzipping an archive.

New block_hooks field

WordPress 6.4 introduced a new block_hooks field to block type registration and the REST API. This field was necessary to introduce the new Block Hooks API, a feature that provides an extensibility mechanism for dynamic blocks.

Media/Attachment updates

WordPress 6.4 shipped several updates to media handling under the hood. The first is a change to the get_available_post_mime_types() filter hook introduced earlier in the development cycle. It was renamed to pre_get_available_post_mime_types for clarity. Make sure that you update any references in your plugins if you have already been using this hook.

The wp_get_loading_optimization_attributes() function supports arbitrary context values rather than those only supported by core, allowing you to rely on custom contexts when rendering images. Alongside this update, there is a new wp_loading_optimization_force_header_contexts filter hook.

There are also two new filter hooks that allow you to customize the results of the wp_get_loading_optimization_attributes() function:

  • wp_get_loading_optimization_attributes for customizing the results after the WordPress logic.
  • pre_wp_get_loading_optimization_attributes for short-circuiting the function and rolling your own logic.

HTML API updates

The HTML API has received several updates in WordPress 6.4:

HTTP API deprecations

If you’re using the HTTP API, check these WordPress 6.4 class and hook deprecations and update your code if necessary:

Bypass WP_Term_Query cache with new parameter

WordPress 6.4 introduces a cache_results parameter for the WP_Term_Query class. This change brings it up to date with WP_Query and WP_User_Query, allowing you to bypass query caches.

Login and registration updates

A few changes to login and registration pages landed in WordPress 6.4:

If your plugin or theme customizes these pages in any way, make sure you test against these changes. You can read more about the updates in the dev note.

KSES updates

The wp_trigger_error() function in WordPress 6.4 passes content through wp_kses() with a limited subset of HTML:

  • <a href> (http and https protocols allowed)
  • <br>
  • <code>
  • <em>
  • <strong>

writing-mode has also been added to the list of safe CSS properties.

Themes

Aspect ratios removed

Gutenberg 16.9 removed the 10:16 and 16:10 aspect ratios from all instances. This should not impact most themes. But you should check if you were using this aspect ratio in any patterns or templates for images.

Template Part falls back to active theme

If the Template Part block has no theme attribute defined, it will automatically fall back to the value of get_stylesheet() (the currently active theme).

CSS Level 4 viewport-relative units support

Gutenberg 16.9 introduced wide support for viewport-relative CSS units. They are not exposed by default, but you can enable them via the settings.spacing.units property in theme.json. Container-query units are still unsupported, despite nearly as much browser support (though they can be used when manually defining spacing and font-size presets).

Pattern updates

There are two changes that you should be aware of in development:

The below changes are within the user interface and should make it easier to create and test patterns:

Term Description block in WordPress

With the 6.4 release, the Term Description block has been ported to WordPress, which means you can start using it within theme templates and patterns. Previously, it was only available in the Gutenberg plugin.

Bug fixes

You can now enjoy several bug fixes that have landed in the last couple of Gutenberg releases:

Events and resources

Learn WordPress

In the past month, five new tutorials landed on the Learn WordPress site:

Developer Hours and Hallway Hangouts

Two developer-focused live sessions were held in the past month and are available to watch on WordPress TV:

Developer Blog

Aside from our regular monthly update on the Developer Blog, a single tutorial was published:

Props to @bph for co-wrangling these resources, @laurlittle and @juanmaguitar for feedback and review, and @jameskoster for the block renaming graphic.

Categories: , ,

2 responses to “What’s new for developers? (November 2023)”

  1. Grzegorz Avatar

    That’s a rich update. I appreciate the continued support for the block update.

  2. Jansen Avatar

    Nice work WP team! Very thrilled to see block hooks.

Leave a Reply

Your email address will not be published. Required fields are marked *