Miscellaneous developer changes in WordPress 6.8

WordPress 6.8 delivers a broad set of developer-focused enhancements that improve extensibility, consistency, and modern standards across the platform. These updates include changes to shortcodes and media handling, expanded theme and 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. support, improved adminadmin (and super admin) validation and hooksHooks In WordPress theme and development, hooks are functions that can be applied to an action or a Filter in WordPress. Actions are functions performed when a certain event occurs in WordPress. Filters allow you to modify certain functions. Arguments used to hook both filters and actions look the same., and fine-tuned control over post type registration and scheduling APIs. While these updates may not individually warrant their own developer note, they collectively represent important refinements for pluginPlugin A plugin is a piece of software containing a group of functions that can be added to a WordPress website. They can extend functionality or add new features to your WordPress websites. WordPress plugins are written in the PHP programming language and integrate seamlessly with WordPress. These can be free in the WordPress.org Plugin Directory https://wordpress.org/plugins/ or can be cost-based plugin from a third-party, theme, and site developers working with WordPress under the hood. This post rounds up the miscellaneous changes worth knowing as you prepare your code for WordPress 6.8.


Table of contents


Removed option to disable the Visual Editor from user profile settings

The option to disable the visual editor was used to enforce the usage of the text interface in the classic editor. This setting was removed in #34681. The setting is removed conditionally; if you have it enabled, it will remain enabled and editable until it is disabled for a user.

The text editor will continue to be an option for all users. $user->rich_editing continues to be a valid user profile field, and the visual editor can be disabled by toggling that value to false.

Example code:

update_user_option( $user_id, 'rich_editing', 'false' );


Changed WP_Image_Editor::generate_filename( $suffix ) to allow empty string as a suffix

The previous  implementation of the WP_Image_Editor::generate_filename() method automatically appended a dimension suffix (e.g., -600×800) to the file name when no $suffix is provided, or when it is any “falsey” value (e.g., null or false). 

With the addition of image format switching like the switch from .heic to .jpg added in #62359, it became more apparent that there was a need to create copies of files without changing their file names.

In #62385, the behavior of this method was changed to accept an empty string as an intentional value for $suffix. The method will treat false or null as empty values where a dimension suffix should be generated; but will treat an empty string as the desired value for the suffix.

The default function value remains null

For extenders, if you are passing a value into the generate_filename() that could be an empty string, you should ensure that the variable type is null or bool to keep your method behavior unchanged.


In #60969, validation was added to the classic menu administration when adding custom links. This validation matches the existing validation used in the CustomizerCustomizer Tool built into WordPress core that hooks into most modern themes. You can use it to preview and modify many of your site’s appearance settings. when adding custom links. It is a partial validation, checking for the following structures:

 * – http://example.com/

 * – //example.com

 * – /directory/

 * – ?query-param

 * – #target

 * – mailto:foo@example.com

If your use case requires content in a custom link’s href attribute that is not a generally valid URLURL A specific web address of a website or web page on the Internet, such as a website’s URL www.wordpress.org pattern, it may no longer be accepted.


New action hook in Import administration screen

A new action hook, import_filters, has been introduced to the Import administration screen (/wp-admin/import.php). This enhancementenhancement Enhancements are simple improvements to WordPress, such as the addition of a hook, a new feature, or an improvement to an existing feature. allows developers to execute custom functions at the end of the importers page, aligning its extensibility with other administration screens like Tools. The hook is implemented as follows:

/**
 
* Fires at the end of the importers Administration screen.
 
 */
 
do_action( 'import_filters' );

This addition provides a standardized method for extending the importers page, facilitating the integration of custom functionalities. For more details, refer to #54419.


Update to wp_video_shortcode() HTMLHTML HyperText Markup Language. The semantic scripting language primarily used for outputting content in web browsers. attributes

The wp_video_shortcode() function has been updated to generate valid HTML by properly handling boolean attributes. Previously, attributes like loop, autoplay, and muted were assigned a value of "1", leading to HTML validation errors. Now, these attributes are rendered without values, aligning with HTML specifications for boolean attributes. For instance, the loop attribute will now appear as loop instead of loop="1". This change ensures that video elements produced by the shortcodeShortcode A shortcode is a placeholder used within a WordPress post, page, or widget to insert a form or function generated by a plugin in a specific location on your site. are semantically correct and pass HTML validation. For more details, refer to #60178.


Update to wp_audio_shortcode() HTML Attributes

The wp_audio_shortcode() function has been updated to generate valid HTML by properly handling boolean attributes. Previously, attributes like loop, autoplay, and muted were assigned a value of "1", leading to HTML validation errors. Now, these attributes are rendered without values, aligning with HTML specifications for boolean attributes. For instance, the loop attribute will now appear as loop instead of loop="1". This change ensures that audio elements produced by the shortcode are semantically correct and pass HTML validation. For more details, refer to #61515.


New embeddable argument for register_post_type()

A new embeddable argument has been introduced to the register_post_type() function, allowing developers to control the embeddability of custom post types. By default, this parameter inherits its value from the public argument, ensuring that publicly accessible post types remain embeddable unless explicitly specified otherwise. This enhancement provides greater flexibility in managing content embedding, enabling developers to restrict embedding for specific post types as needed. For more details, refer to #35567.


Updates to body_class classes

Some new classes were introduced to the <body> tagtag A directory in Subversion. WordPress uses tags to store a single snapshot of a version (3.6, 3.6.1, etc.), the common convention of tags in version control systems. (Not to be confused with post tags.).

The classes wp-theme-<name> and wp-child-theme-<name (when the current theme is a child themeChild theme A Child Theme is a customized theme based upon a Parent Theme. It’s considered best practice to create a child theme if you want to modify the CSS of your theme. https://developer.wordpress.org/themes/advanced-topics/child-themes/.) were added, where <name> represents the sanitized name of the active theme. Please note that these classes are added on both front-end and in the administration. For more information, refer to #19736.

The wp-singular class was added to the list of body classes when viewing a single post object. This class includes a wp- prefix to avoid conflicts with existing classes in themes or plugins. For more information, refer to #35164.


readme.html file is now noindex,nofollow

Because site owners likely don’t intend for the content of the readme.html file to be indexed, as it’s unrelated to the site content. A noindex,nofollow metaMeta Meta is a term that refers to the inside workings of a group. For us, this is the team that works on internal WordPress sites like WordCamp Central and Make WordPress. tag was added to this file, to prevent it from being indexed. Polyglot teams that are translating this file manually are encouraged to update their version. For more information, refer to #63069.


Style Book availability for classic themes

The Style Book feature has been extended to support classic themes. This enhancement allows developers and users to preview and understand site colors, typography, and block styles within the context of their classic themes. To utilize the Style Book in a classic theme, ensure that the theme either:

  • Supports editor styles: Implement this by adding add_theme_support( 'editor-styles' ); in the theme’s functions.php file.
  • Includes a theme.json file: Incorporate a theme.json configuration file to define global styles and settings.

By adopting either of these methods, classic themes can leverage the Style Book’s capabilities, providing a more consistent and customizable editing experience.

For detailed guidance on integrating theme.json into classic themes, refer to the Global Settings & Styles (theme.json) – Block Editor Handbook. Additionally, the tutorial “Using theme.json with classic themes” offers practical insights and examples. These resources provide comprehensive information on enhancing classic themes with modern styling capabilities. For more information, refer to #62509.


Enabling Block Hooks for post content

The Block Hooks mechanism has been extended to apply to post content, in addition to its existing support for templates, template parts, patterns, and navigation menus. This enhancement allows developers to insert hooked blocks directly into posts and pages, offering greater flexibility in content customization.

Key considerations:

  • User expectations: Aligns block insertion capabilities with user expectations across various site components.
  • Content management: Introduces the ability to manage hooked blocks within individual posts and pages, enhancing content control.

This update provides developers with expanded tools for dynamic content placement, improving the customization capabilities. For more information, refer to #61074.


Block Hooks enabled for Synced Patterns

The Block Hooks feature has been extended to support synced patterns (i.e., core/block blocks). Previously, Block Hooks were applied to templates, template parts, patterns, navigation menus, and post content. This enhancement ensures consistent behavior across all these entities, allowing developers to insert hooked blocks into synced patterns seamlessly. This update provides greater flexibility and control over content customization within the WordPress ecosystem. For more information, refer to #62704.


Standardized behavior for render_block_context 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.

The behavior of the render_block_context filter has been standardized to ensure consistent application across all block levels. Previously, this filter applied differently to top-level blocks compared to inner blocks, leading to inconsistencies in context propagation. Specifically, context provided via render_block_context was available to inner blocks when applied to top-level blocks, but not when applied to inner blocks.

This discrepancy has been addressed, ensuring that context supplied through the filter is uniformly available to all nested inner blocks, regardless of their position within the block hierarchy. For more information, refer to #62046.


Cron 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.: Introduce a new filter of the same name to wp_next_scheduled()

The wp_next_scheduled hook allows plugin developers to modify the timestamp of the next scheduled event for a given wp-cron job. The full event object, hook name and arguments are provided as additional arguments for this filter. Fore more information, refer to #52655.


HDR Image support for Imagick: new filter to control maximum bit depth of resized images

WordPress 6.8 introduces a new filter, image_max_bit_depth, that developers can use to control the maximum bit depth for resized images. The filter is also passed the original bit depth of the uploaded image. Note that this filter only works when the site’s hosting supports Imagick and coreCore Core is the set of software required to run WordPress. The Core Development Team builds WordPress. is using the Imagick editor because the GD image editor does not support reading or controlling bit depth (#62285).

By default, the maximum depth matches the bit depth of the original uploaded image. Previously, the maximum bit depth was reduced to 8 for images with higher bit depths, so HDR images were always output with reduced bit depth. Starting in 6.8 HDR images will be output with the bit depth they are uploaded with (for example 12 bits). To enforce the previous behavior, developers can use the following code:

{{{
add_filter( ‘image_max_bit_depth’, function( $max_depth, $original_depth ) { 
	return ( 8 &lt; $original_depth ) ? 8 : $original_depth;
} ); 
}}}

Media: enable setting image output quality by image size

A new $size parameter was added to the wp_editor_set_quality filter. $size is an array with ‘width’ and ‘height’ keys. Developers can use this information to set image quality based on the image size, for example using a lower quality setting for small images (#54648).


Media: control uploading of unsupported media types

In 6.8, a new filter wp_prevent_unsupported_mime_type_uploads controls the behavior of the editor and media library when users upload an image type that the server does not support. By default, users will see an error message that “This image cannot be processed by the web server. Convert it to JPEG or PNG before uploading”. Developers can return false from the filter to enable uploading of these images; however, sub-sized images will not be created (#61167).


UPDATE (14 April 2025): Updated is_embeddable to embeddable for 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. on #35567. Props @mat-lipe.

UPDATE (14 April 2025): Updated after_importers to import_filters for dev note on #54419. Props @afercia.


Props to @joedolson @audrasjb @webcommsat @joemcgill @benjamin_zekavica @peterwilsoncc @adamsilverstein @azaozz for input and review.

#6-8, #dev-notes, #dev-notes-6-8