Block Locking Settings in WordPress 6.0

WordPress 6.0 makes it easier to lock blocks using the new controls modal. The release also includes two new settings to choose who can access this option and when.

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. Editor

The new canLockBlocks setting can disable the feature globally or conditionally. Example:

add_filter(
	'block_editor_settings_all',
	function( $settings, $context ) {
		// Allow for the Editor role and above - https://wordpress.org/support/article/roles-and-capabilities/.
		$settings['canLockBlocks'] = current_user_can( 'delete_others_posts' );

		// Only enable for specific user(s).
		$user = wp_get_current_user();
		if ( in_array( $user->user_email, [ 'user@example.com' ], true ) ) {
			$settings['canLockBlocks'] = false;
		}

		// Disable for posts/pages.
		if ( $context->post && $context->post->post_type === 'page' ) {
			$settings['canLockBlocks'] = false;
		}

		return $settings;
	},
	10,
	2
);

Blocks

The lock property allows hide controls on a block type level. Example:

{
	"apiVersion": 2,
	"supports": {
		"lock": false
	}
}

For more info see #39183.

An earlier post on this blogblog (versus network, site) covers, the Curated experiences with locking APIs & theme.json

#6-0, #dev-notes, #dev-notes-6-0

Updates to the @wordpress/create-block templating system

A powerful feature of the @wordpress/create-block package is the ability to create templates to allow customization of how a 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. is structured.

WordPress 6.0 introduces some new template variables to allow even more customization. Templates can now use the customScripts variable to create new entries in the scripts property of the package.json file and while it was already possible to define dependencies, it is now also possible to defined a list of development dependencies using the npmDevDependencies variable. In addition to these new template variables, the @wordpres/env package will automatically be added to the list of devDependences when the template uses the wpEnv template variable or if the —wp-env flag is passed as a command line argument.

For more info see #38535#39723, and #38530.

#6-0, #dev-notes, #dev-notes-6-0

WordPress 6.0 Release Candidate Phase

Now that WordPress 6.0 has entered the Release Candidaterelease candidate One of the final stages in the version release cycle, this version signals the potential to be a final release to the public. Also see alpha (beta). phase, the following policies are in place.

These policies mainly cover how and when CoreCore Core is the set of software required to run WordPress. The Core Development Team builds WordPress. committers can commit. For non-committing contributors, this post may help explain why a Core committercommitter A developer with commit access. WordPress has five lead developers and four permanent core developers with commit access. Additionally, the project usually has a few guest or component committers - a developer receiving commit access, generally for a single release cycle (sometimes renewed) and/or for a specific component. makes a certain decision.

String Freeze

To allow the Polyglots teamPolyglots Team Polyglots Team is a group of multilingual translators who work on translating plugins, themes, documentation, and front-facing marketing copy. https://make.wordpress.org/polyglots/teams/. time to get their local language’s translationtranslation The process (or result) of changing text, words, and display formatting to support another language. Also see localization, internationalization. of WordPress ready, no new strings are permitted to be added to the release. Existing strings can be removed and/or duplicated if needed.

Seek guidance from the Polyglots team leadership for any strings reported as buggy. A buggy string is one that can not be translated to all languages in its current form. 

Tickets on the WordPress 6.0 milestone

For the remainder of the cycle, only two types of tickets may be placed on/remain on the 6.0 milestone:

  • Regressions: bugs that have been introduced during the WordPress 6.0 development cycle, either to existing or new features.
  • Test suite expansion: tests can be committed at any time without regard to code or string freezes. This can cover either new or existing features.

Trunktrunk A directory in Subversion containing the latest development code in preparation for the next major release cycle. If you are running "trunk", then you are on the latest revision. is now WordPress 6.1-alpha

WordPress 6.0 was recently forked to its own branchbranch A directory in Subversion. WordPress uses branches to store the latest development code for each major release (3.9, 4.0, etc.). Branches are then updated with code for any minor releases of that branch. Sometimes, a major version of WordPress and its minor versions are collectively referred to as a "branch", such as "the 4.0 branch"., trunk is now open for commits for the next version of the software.

Backporting to the 6.0 branch

Backporting commits of production code (that is, anything that ends up in the zip file) now requires double sign-off by two core committers. The dev-feedback keyword should be used to request a second committer’s review, dev-reviewed should be added to indicate a second committer has reviewed and approved the commit to the 6.0 branch.

Commits to the test suite do not require double sign-off.

Dev Chat Agenda, May 4, 2022

This weekly WordPress Developers Chat takes place in the #Core channel of the Make WordPress SlackSlack Slack is a Collaborative Group Chat Platform https://slack.com/. The WordPress community has its own Slack Channel at https://make.wordpress.org/chat/. on Wednesday May 4, 2022 at 20:00 UTC. All welcome.

1. Welcome

Dev Chat summary from the meeting on April 27, 2022 – @webcommsat

2. Announcements

WordPress 6.0 Release Candidate 1 (released on May 3, 2022). This was the hard string freeze for the 6.0 and branchbranch A directory in Subversion. WordPress uses branches to store the latest development code for each major release (3.9, 4.0, etc.). Branches are then updated with code for any minor releases of that branch. Sometimes, a major version of WordPress and its minor versions are collectively referred to as a "branch", such as "the 4.0 branch". for the release.

WordPress 6.0 Beta 4 (released on May 2, 2022).

Early focused meetings will take place on Mondays at a revised time of 18:00 UTC.

What’s New in Gutenberg 13.1 (April 27, 2022).

3. Blogblog (versus network, site) posts of note to coreCore Core is the set of software required to run WordPress. The Core Development Team builds WordPress.

Key links for 6.0 and updates from the squad will be in the agenda item 4, after these blog posts.

A Week in Core – May 2, 2022

Full Site Editing (FSE) Outreach Program Testing Call 14: Rallying Recipe Reviewers (April 28, 2022). Leave feedback by May 18, 2022

Any others?

4. Upcoming releases

Next major: WordPress 6.0

Updates from Release Co-ordinators and members of the squad.

Useful resources/ calls for testing

5. Open floor

If you have any items for Open Floor, please add them in the comments below.

If you are a component maintainer and wish to raise a ticketticket Created for both bug reports and feature development on the bug tracker. in dev chat or give an update, you can also add information in the comments section.

Could you help with writing the summary from dev chat for a future meeting? Comment below or message core team reps @marybaum and @audrasjb in the Core Slack channel.

Props to: @webcommsat and @marybaum for working on items for the agenda.

#6-0, #agenda, #dev-chat

Performance team meeting summary 3 May 2022

Meeting agenda here and the full chat log is available beginning here on Slack.

Focus group updates

Images

@adamsilverstein @mikeschroder

GitHub project

Feedback requested

Object Cache

@tillkruess @spacedmonkey

GitHub project

Feedback requested

Site Health

N/A

GitHub project

  • We’re seeking 1-2 POCs for this group; if you’re interested, please comment here or pingPing The act of sending a very small amount of data to an end point. Ping is used in computer science to illicit a response from a target server to test it’s connection. Ping is also a term used by Slack users to @ someone or send them a direct message (DM). Users might say something along the lines of “Ping me when the meeting starts.” in SlackSlack Slack is a Collaborative Group Chat Platform https://slack.com/. The WordPress community has its own Slack Channel at https://make.wordpress.org/chat/.
  • @furi3r: PR for Site Health test for full page caching is still open; would love another review to get into the next release@flixos90 will take another look
  • @flixos90: Is there any update on the work to refine the two existing experimental Site Health modules to make them non-experimental and eventually merge to coreCore Core is the set of software required to run WordPress. The Core Development Team builds WordPress.?
    • @furi3r: We should go over them again and take another look
  • @spacedmonkey: Should we use next week’s meeting to decide what we want to get merged into 6.1
    • @flixos90: Great idea, as well as looking owners for whatever we decide on

Feedback requested

Measurement

N/A

GitHub project

  • We’re seeking 1-2 POCs for this group; if you’re interested, please comment here or ping in Slack
  • No updates

Feedback requested

JavaScriptJavaScript JavaScript or JS is an object-oriented computer programming language commonly used to create interactive effects within web browsers. WordPress makes extensive use of JS for a better user experience. While PHP is executed on the server, JS executes within a user’s browser. https://www.javascript.com/.

@aristath @sergiomdgomes

GitHub project

  • No updates

Feedback requested

Infrastructure

@flixos90

GitHub project

  • @flixos90: Decision has been made to follow WP core’s versioning approach for our 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 based on the vote in Define plugin versioning approach #300, so next release will be 1.1.0.
  • @flixos90: The other decision we need to make is about release cadence in Define plugin release cadence #320.
    • Before 1.0.0, we published every two weeks, which is the minimum but requires some additional maintenance and overhead, so a timeline of four weeks or more is probably better. At the same time, we don’t want to go too long and lose momentum.
    • @adamsilverstein: Monthly feels straightforward to keep track of; longer gets more difficult
    • @pbearne: A 4 week cycle feels right to me
    • @eugenemanuliov: Yes, 4 weeks seems to be most appropriate
    • @jeffpaul: 10up open sourceOpen Source Open Source denotes software for which the original source code is made freely available and may be redistributed and modified. Open Source **must be** delivered via a licensing model, see GPL. team checks what’s releasable on the first day of the month and determines if it requires a major, minor, or no release. If there’s a release, it’s done in a subsequent week that month.
    • @flixos90: Could also do monthly, e.g. third Monday of the month. Will add to the options in the issue.
    • Vote is open here until next Monday

Feedback requested

Open floor

  • @jb510: Research: Impact of additional WebP images on upload #289 focuses on the file system impact of WebP. But when an image is uploaded to a post, there is the time it takes the original to upload, but then the user has to wait while additional image sizes are generated and the progress bar for that action completes. We should then consider the impact of WebP generation has on that already sometimes frustrating delay between generating JPEG only vs JPEG+WebP. Want to make sure this is being considered. I recommend moving this to the background.
    • @jeffpaul: Agreed, that UXUX User experience is quite painful
    • @adamsilverstein: Moving to the background would make sense, as that image generation is slow and can break if you navigate away from the editor. Related Gutenberg issue.
    • @adamsilverstein: Note that the progress bar only shows upload progress, not processing progress
    • @pbearne: Once WP has the image, we should be able to release the editor and do the processing in a new thread
    • @jb510: For scope, consider 1) measuring impact of additional processing/completion time due to WebP and 2) finding a way to move that out of blocking the user from continuing with what they wanted to be doing

Help wanted

#core-js, #core-media, #performance, #performance-chat, #summary

Miscellaneous Dev Notes for WordPress 6.0

Here are notes to a few further adjustments coming to WordPress 6.0 for developers.

Upgrade/Install

Replace a 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 description on the Plugins > Add New Screen

The patchpatch A special text file that describes changes to code, by identifying the files and lines which are added, removed, and altered. It may also be referred to as a diff. A patch can be applied to a codebase for testing. #55480 introduces the plugin_install_description 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. in the WP_Plugins_Install_List_Table.

This new filter allows developers to modify or replace the description of a plugin on the Plugins > Add New and/or Networknetwork (versus site, blog) Adminadmin (and super admin) > Plugins > Add New screens.

The following example shows how to replace the description of specific plugin:

function wporg_plugin_install_description( $description, $plugin_data ) {
	if ( 'my-plugin' === $plugin_data['slug'] ) {
		$description = esc_html__( 'A new description for My Plugin', 'textdomain' );
	}

	return $description;
}
add_filter( 'plugin_install_description', 'wporg_plugin_install_description', 10, 2 );

For more info see #55480.

Users

Add ability to filter whole notification email in retrieve_password

New WordPress release introduces two new 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. to help developers to filter retrieve password emails:

  • send_retrieve_password_email can be used to filter whether to send the retrieve password email;
  • retrieve_password_notification_email can be used to filter the contents of the reset password notification email sent to the user.

For consistency with some similar filters like send_password_change_email or send_email_change_email, and for more flexibility, pass $user_login and $user_data parameters directly to the new send_retrieve_password_email and retrieve_password_notification_email filters.

apply_filters( 'send_retrieve_password_email', true, $user_login, $user_data );
apply_filters( 'retrieve_password_notification_email', $defaults, $key, $user_login, $user_data );

For more info see #54690.

Toolbar

Site icons in the toolbar My Sites menu

In large multisitemultisite Used to describe a WordPress installation with a network of multiple blogs, grouped by sites. This installation type has shared users tables, and creates separate database tables for each blog (wp_posts becomes wp_0_posts). See also network, blog, site networks, the site icons added to the toolbar navigation in WordPress 5.8 could make pages load significantly slower. To remove these icons, use the wp_admin_bar_show_site_icons filter.

add_filter( 'wp_admin_bar_show_site_icons', '__return_false' );

Without using the filter, these icons now include lazy loading when it is enabled for images. The loading attribute can be removed if it does not fit a site specifically in this context.

function wporg_disable_toolbar_image_lazy_loading( $default, $tag_name, $context ) {
    if ( 'img' === $tag_name && 'site_icon_in_toolbar' === $context ) {
        return false;
    }
    return $default;
}
add_filter( 'wp_lazy_loading_enabled', 'wporg_disable_toolbar_image_lazy_loading', 10, 3 );

For more info see #54447.

#6-0, #dev-notes, #dev-notes-6-0

Block Editor miscellaneous Dev Notes for WordPress 6.0

Updated 2022-05-07 with a table of content, two more dev notesdev 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 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. and some formatting –bph

Table of Contents


Removed bottom margin on LineHeightControl component

Several UIUI User interface components currently ship with styles that give them bottom margins. This can make it hard to use them in arbitrary layouts, where you want different amounts of gap or margin between components.

To better suit modern layout needs, we will gradually deprecate these bottom margins. A deprecation will begin with an opt-in period where you can choose to apply the new margin-free styles on a given component instance. Eventually in a future version, the margins will be completely removed.

In WordPress 6.0, the bottom margin on the LineHeightControl component has been deprecated. To start opting into the new margin-free styles, set the __nextHasNoMarginBottom prop to true:

<LineHeightControl
  value={ lineHeight }
  onChange={ onChange }
  __nextHasNoMarginBottom={ true }
/>

For more info see #37160.

Props to @0mirka00 for writing this 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 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.. (top)

Unrecognized 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. preservation

We’ve started making strides in preserving unrecognized content in the editor, also called (sometimes incorrectly) “invalidinvalid A resolution on the bug tracker (and generally common in software development, sometimes also notabug) that indicates the ticket is not a bug, is a support request, or is generally invalid.” or “missing.” In situations where the editor is unable to validate a loaded block against its implementation we run into numerous cases where content has previously been lost or corrupted, notably when inner blocks are involved.

Currently, we’re on the journey to preserving that original unrecognized content but have many corners in the project to update before it’s finished. Notably, when loading posts in the editor or in the code view that content will be preserved as it was loaded. Surprisingly, this lets us do something we’ve never been able to do before: intentionally create certain kinds of broken blocks within the code editor, or modify and fix blocks in the code editor whose block implementation is missing.

Still on the list to update are smaller parts of the flow such as the array of confusing block resolution dialogs and operations as well as certain validation steps that currently fail but shouldn’t.

In short, if you’ve been frustrated by the editor breaking your posts as soon as you hit “save” then good news is coming in 6.0.

For more info see #38794, #38923, and #39523.

Props to @dmsnell for writing this dev note.(top)

Registration of Blocks from within Themes

Until WordPress 6.0, building blocks inside plugins was the only way possible if you wanted to use block.json. This remains to be the recommended way to build Custom blocks  going forward. Blocks add functionality and therefore should be built as plugins that stay active even when a new theme is enabled. 

There are however instances where the styling and functionality of a block is so tightly coupled with a theme that it doesn’t make sense to have a block active without a given theme. This is true when building custom solutions, and the blocks are site-specific and not used for other instances. Furthermore, from discussion with agency project managers and developers, it turns out that there are considerable deployment costs when separating comprehensive solutions.

Each implementation had to reinvent a way to register blocks within themes, as WordPress coreCore Core is the set of software required to run WordPress. The Core Development Team builds WordPress. wouldn’t allow for it. With 6.0 the registration of blocks using block.json from within a theme is now technically standardized. You can use the same register_block_type function as you would inside a 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 and all the assets that you may register in the block.json file like the editorScript, style, etc get enqueued correctly.

For more info see #55513.

Props to @fabiankaegy for writing this dev note.(top)

Comments blocks – Enable legacy Post Comments block

With WordPress 6.0, there is a new set of blocks to show the Comments of a post:

  • Comments Query Loop: An advanced block that displays post comments and allows for various layouts and configurations.
    • Comment Template: Contains the block elements used to display a comment, such as the title, date, author, avatarAvatar An avatar is an image or illustration that specifically refers to a character that represents an online user. It’s usually a square box that appears next to the user’s name. and more.
    • Comments Pagination: Displays next/previous links to paginated comments where this has been enabled in the comment settings in the WordPress adminadmin (and super admin)
      • Previous Page: Displays the link to the previous page of comments.
      • Page Numbers: Displays a list of page numbers for comments pagination.
      • Next Page: Displays the link to the next page of comments.

The legacy Post Comments block, which directly renders the comments.php file, has been deprecated and hidden. It will still work for themes currently using it, but it won’t appear in the inserter.

The new set of blocks provides almost the same functionalities with the benefit that the layout and styles can be customized from the Editor. However, if any user wants to re-enable the Post Comments legacy block, they can use the block registration filters and adapt it to their needs. For example, this piece of code shows the legacy block in the inserter again and removes the “deprecated” from the title:

function wporg_enable_post_comments_legacy_block( $metadata ) {
    if ( 'core/post-comments' === $metadata['name'] ) {
        $metadata['title'] = esc_html__( 'Post Comments', 'textdomain' );
	$metadata['supports']['inserter'] = true;
    }
    return $metadata;
}
add_filter( 'block_type_metadata', 'wporg_enable_post_comments_legacy_block' );

For more info see #34994.

Props to @SantosGuillamot and @annezazu for writing this dev note.(top)

In order to implement this the spacing of the Gallery images had to be changed from a right margin setting to the CSSCSS Cascading Style Sheets. gap property. Themes or plugins that use a right margin setting to manually adjust the Gallery image spacing may need to be updated to instead override the gap setting.

Default gap changed

The new block editor block gap support functionality has been used to implement this and this adds a default block gap of 0.5em. For some themes that don’t explicitly set this gap, the default will change from the previous 16px to 0.5em. If plugin or theme developers want to ensure that the 16px gap remains the following CSS can be added to the theme, or site custom CSS:

.wp-block-gallery {
	--wp--style--gallery-gap-default: 16px;
}

Gallery Image bottom margins removed

Some themes may have depended on the bottom margin set on the gallery images to provide a gap between two galleries. Because the gallery now uses the flex gap for spacing this bottom margin is no longer set. Themes that were relying on this unintended side effect of the image margins will need to add the following CSS in order to maintain a gap between galleries:

.wp-block-gallery {
	margin-top: 16px;
}

Gallery gutter CSS var deprecated

To keep the naming of the gap setting consistent the --gallery-block--gutter-size CSS var has been deprecated and replaced with --wp--style--gallery-gap-default--gallery-block--gutter-size will continue to work in release 6.0 and will be removed in 6.1.

Theme authors should be able to provide compatibility for WP 5.9 and 6.0+ with the following:

.wp-block-gallery {
        --gallery-block--gutter-size: var( --wp--custom--spacing--4 );
	--wp--style--gallery-gap-default: var( --wp--custom--spacing--4 );
}

For more info see #40008.

Props to @glendaviesnz for writing this dev note.(top)

New ancestor property in block.json

Block developers sometimes need to restrict where users can place their blocks. For that, developers already count on APIs like block.json‘s parent property or the allowedBlocks option of the useInnerBlocksProps hook that allowed developers to express some basic, direct parent-children relations between blocks.

Since WordPress 6.0, the ancestor property makes a block available inside the specified block types at any position of the ancestor block subtree. That allows, for example, to place a ‘Comment Content’ block inside a ‘Column’ block, as long as ‘Column’ is somewhere within a ‘Comment Template’ block. In comparison to the parent property, blocks that specify their ancestor can be placed anywhere in the subtree, while blocks with a specified parent need to be direct children.

This property admits an array of block types in string format, making the block require at least one of the types to be present as an ancestor.

{
    "$schema": "https://schemas.wp.org/trunk/block.json",
    "apiVersion": 2,
    "name": "core/comment-content",
    "ancestor": [ "core/comment-template" ],
    ...
}

Block developers can also combine parent with ancestor inside block.json and use them together to express more complex relations if needed. For example:

  • Parent [ 'A' ] and ancestor [ 'C' ] would work as ”parent A and ancestor C”.
  • Parent [ 'A', 'B' ] and ancestor [ 'C', 'D' ] would work as ”parent (A or B) and ancestor (C or D)”.

Note that there are some edge cases uncovered by this 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., like blocks that would require two or more different ancestor types simultaneously.

For more info see #39894.

Props to @darerodz for writing this dev note. (top)

Changes to media object returned from the WordPress data module

A small change has been made to the way the media objects are retrieved using the data module. The “caption”, “title” and “description” properties are returned as strings when using the `wp.data.select(‘core’).getRawEntityRecord` selector or the `wp.coreData.useEntityProp` hook.

Before

const [ renderedTitle ] = useEntityProp( 'root', 'media', id )?.rendered;

After

const [ renderedTitle ] = useEntityProp( 'root', 'media', id );

Props to @youknowriad for writing the note.

Removed Deprecated APIs

Some low-impact APIs that were deprecated on WordPress 5.4 have now been removed:

  • getReferenceByDistinctEdits selector.
  • PreserveScrollInReorder component.
  • dropZoneUIOnly prop in the MediaPlaceholder component.
  • isDismissable prop in the Modal component.
  • wp.data.plugins.control data module.

You can find more details on the #38564 removing these APIs

Slated to be removed in WordPress 6.2

The APIs listed have been deprecated in WordPress 5.3 and were forwarded in the background to the new ones already. They will be entirely removed in WordPress 6.2.

OldNew
wp.editor.+[name]wp.blockEditor.+[name]
wp.data.dispatch( 'core/editor' ).+ namewp.data.dispatch( 'core/block-editor' ). + name
wp.data.select( 'core/editor' ).+ namewp.data.select( 'core/block-editor' ). + name
wp.components.ServerSideRenderwp.serverSideRender

More details and discussion on PR #37854

Props to @youknowriad for writing the note.(top)

#6-0, #dev-notes, #dev-notes-6-0

Separator block: Updated to use block supports color settings

To allow the setting of a custom opacity for each 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., the Separator block has been updated to use the block that supports color settings. The custom opacity can then be set using the alpha channel setting of the selected color.

The HMTL structure of the block is unchanged, and all the existing classes are still in place, and two additional classes have been added – .has-alpha-channel-opacity and .has-css-opacity

These new classes have been added to maintain the default 0.4 opacity for all existing blocks in both the editor and the frontend. The opacity for existing Separator blocks will only change if the block itself has its color setting changed. If theme authors have opted in to block styles with add_theme_support( 'wp-block-styles' ); and wish to maintain the default 0.4 opacity setting for both new and old blocks the following CSSCSS Cascading Style Sheets. can be added:

hr.wp-block-separator.has-alpha-channel-opacity {
	opacity: 0.4;
}

#6-0, #dev-notes, #dev-notes-6-0

Support for handling resolution errors for Editor data module

WordPress 6.0 no longer ignores the exceptions thrown by the resolvers.

In WordPress 5.9 and earlier, an exception thrown inside the resolver kept it in the resolving state forever. It never got marked as finished. In WordPress 6.0, the resolver state is set to error and the exception is re-thrown. This backwards compatibility-breaking change affects both resolvers from newly registered stores and the resolvers from the WordPress stores, e.g. the getEntityRecord resolver from the coreCore Core is the set of software required to run WordPress. The Core Development Team builds WordPress. store.

Example:

Let’s register an example store where the resolver always throws an error:

const temperatureStore = wp.data.createReduxStore( 'my-store', {
    selectors: {
        getTemperature: ( state ) => state.temperature
    },
    resolvers: {
        getTemperature: () => { throw new Error( 'Network error' ); }
    },
    reducer: () => ({}), // Bogus reducer for the example
} );
wp.data.registerStore( temperatureStore );

Using that resolver has different results in different WordPress versions:

In WordPress 5.9:

const promise = wp.data.resolveSelect( temperatureStore ).getTemperature();

Error handling is unsupported, so this promise never gets rejected nor resolved.

In WordPress 6.0:

const promise = wp.data.resolveSelect( temperatureStore ).getTemperature();

Error handling is now supported, so this promise gets rejected with Error( ‘Networknetwork (versus site, blog) error’ )

The error details may be retrieved using the hasLastResolutionFailed, getLastResolutionFailure, and `getResolutionState` 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.-selectors available on every registered store:

wp.data.select( temperatureStore ).hasResolutionFailed( 'getTemperature' );
// the above returns: true

wp.data.select( temperatureStore ).getResolutionError( 'getTemperature' );
// the above returns: Error( 'Network error' )

wp.data.select( temperatureStore ).getResolutionState( 'getTemperature' );
// the above returns: { "state": "error", "error": Error( 'Network error' ) }

The state returned by getResolutionState is one of: “resolving”, “finished”, “error”, undefined. The undefined indicates that the resolver hasn’t been triggered yet.

PRs #38669 #39317

#6-0, #dev-notes, #dev-notes-6-0

A Week in Core – May 2, 2022

Welcome back to a new issue of Week in CoreCore Core is the set of software required to run WordPress. The Core Development Team builds WordPress.. Let’s take a look at what changed on TracTrac An open source project by Edgewall Software that serves as a bug tracker and project management tool for WordPress. between April 25 and May 2, 2022.

  • 72 commits
  • 55 contributors
  • 43 tickets created
  • 8 tickets reopened
  • 65 tickets closed

The Core team is currently working on the next major releasemajor release A release, identified by the first two numbers (3.6), which is the focus of a full release cycle and feature development. WordPress uses decimaling count for major release versions, so 2.8, 2.9, 3.0, and 3.1 are sequential and comparable in scope., WP 6.0, and released BetaBeta A pre-release of software that is given out to a large group of users to trial under real conditions. Beta versions have gone through alpha testing in-house and are generally fairly close in look, feel and function to the final product; however, design changes often occur as part of the process. 3 and Beta 4 🛠

Ticketticket Created for both bug reports and feature development on the bug tracker. numbers are based on the Trac timeline for the period above. The following is a summary of commits, organized by component and/or focus.

Code changes

Administration

  • Trigger a notice for incorrect add_menu_page() parameter – #40927

Bootstrap/Load

  • Avoid a PHPPHP The web scripting language in which WordPress is primarily architected. WordPress requires PHP 5.6.20 or higher warning when setting the $pagenow global in wp-includes/vars.php#54700
  • Move some more administration-related 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. to admin-filters.php#54795
  • Move administration related hooks to admin-filters.php#54795

Build/Test Tools

  • Update the NPM dependencies to the latest versions – #54727
  • Reduce file size of About page texture – #48703
  • Add unit tests for wp_fuzzy_number_match()#54239
  • Add unit tests for some XML-RPC functions – #53490
  • Ignore EOL differences in Webfonts 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. tests – #54725

Bundled Themes

  • Note visually hidden text for translators – #55591
  • Update NPM dependencies for default themes – #54727
  • Twenty Twenty-One: Make translator comments referencing the post title consistent – #55564
  • Twenty Twenty-Two: Add three style variations – #55433

Code Modernization

  • Rename parameters that use reserved keywords in wp-includes/class-wp-comment-query.php#55327
  • Rename parameters that use reserved keywords in wp-includes/class-wp-embed.php#55327
  • Rename parameters that use reserved keywords in wp-includes/class-wp-image-editor-gd.php#55327
  • Rename parameters that use reserved keywords in wp-includes/class-wp-image-editor.php#55327
  • Rename parameters that use reserved keywords in wp-includes/class-wp-network-query.php#55327
  • Rename parameters that use reserved keywords in wp-includes/class-wp-query.php#55327
  • Rename parameters that use reserved keywords in wp-includes/class-wp-query.php#55327
  • Rename parameters that use reserved keywords in wp-includes/class-wp-site-query.php#55327
  • Rename parameters that use reserved keywords in wp-includes/class-wp-term-query.php#55327
  • Rename parameters that use reserved keywords in wp-includes/class-wp-user-query.php#55327
  • Rename parameters that use reserved keywords in wp-includes/class.wp-scripts.php#55327
  • Rename parameters that use reserved keywords in wp-includes/class.wp-styles.php#55327
  • Rename parameters that use reserved keywords in wp-includes/comment-template.php#55327
  • Rename parameters that use reserved keywords in wp-includes/deprecated.php#55327

Coding Standards

  • Remove extra alignment level in the data provider for wp_validate_boolean() tests – #54725, #54728
  • Remove extra spaces in docblocks of the Walker_PageDropdown class – #54728

Comments

  • Avoid DB error in comment 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. queries – #55218

Docs:

  • Add missing documentation for WP_*_Query::get_search_sql() method parameters – #54729
  • Adjust comments in Gruntfile.js per the documentation standards – #54729
  • Clarify the name and description of some parameters in the Walker class – #54729
  • Correct alignment for the customize_nav_menu_available_items 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. DocBlockdocblock (phpdoc, xref, inline docs)#54729
  • Correct parameter types for serialize_block() and serialize_blocks()#55648, #54729
  • Corrections and improvements to docblocks for function and hooks relating to fatal error handling – #54729
  • Docblock adjustements in the Walker class – #54729
  • Formatting corrections for various docblocks – #54729
  • Further clarify a comment for the main part of wp-login.php#54746
  • Improve plugin_install_action_links filter’s docs – #55480
  • Improve documentation of the walker argument for various functions – #54729
  • Make the @return 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.) for Translation_Entry::key() more precise – #55640
  • Remove @return void from various DocBlocks – #54729
  • Remove double spaces in tests/phpunit/README.txt#55637
  • Use third-person singular verbs for function descriptions in Core Comment API and Comment template functions – #54729
  • Various docblock corrections – #54729
  • Various docblock corrections and improvements for changes introduced in 6.0 – #54729
  • Various docblock improvements – #54729

Editor

  • Fix core ‘Featured’ pattern categoryCategory The 'category' taxonomy lets you group posts / content together that share a common bond. Categories are pre-defined and broad ranging. registration – #55567
  • Register ‘lock’ attribute for every 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. on the server – #55567
  • Show comment previews in the Comment Query LoopLoop The Loop is PHP code used by WordPress to display posts. Using The Loop, WordPress processes each post to be displayed on the current page, and formats it according to how it matches specified criteria within The Loop tags. Any HTML or PHP code in the Loop will be processed on each post. https://codex.wordpress.org/The_Loop.#55634
  • Update WordPress packages for 6.0 Beta 3 – #55567
  • Update WordPress packages for 6.0 Beta 4 – #55567

External Libraries

  • Update the underscore library to version 1.13.3#55547

Mail

  • Improve the docblocks for actions and functions related to the parsing of authentication cookies – #54729

Media

  • Ensure wp_crop_image() returns correct file type – #55403
  • Ensure wp_read_image_metadata filter returns array for $iptc and $exif#54637
  • Validate track number ID3 tags before use – #55204

Plugins

  • Improve plugin_install_description filter’s docs – #55480

REST APIREST API The REST API is an acronym for the RESTful Application Program Interface (API) that uses HTTP requests to GET, PUT, POST and DELETE data. It is how the front end of an application (think “phone app” or “website”) can communicate with the data store (think “database” or “file system”) https://developer.wordpress.org/rest-api/.

  • Correct the schema for the wp/v2/block-directory/search endpoint – #53621
  • Fixes /wp/v2/pattern-directory/patterns endpoint response for slug parameter – #55617

TaxonomyTaxonomy A taxonomy is a way to group things together. In WordPress, some common taxonomies are category, link, tag, or post format. https://codex.wordpress.org/Taxonomies#Default_Taxonomies.

  • Increase cache hits in WP_Term_Query when using include and exclude parameters – #55352

Themes

  • Add internal-only theme.jsonJSON JSON, or JavaScript Object Notation, is a minimal, readable format for structuring data. It is used primarily to transmit data between a server and web application, as an alternative to XML.’s webfonts handler (stopgap) – #55567, #46370
  • Remove ‘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/’ as translationtranslation The process (or result) of changing text, words, and display formatting to support another language. Also see localization, internationalization. context in _wp_theme_json_webfonts_handler()#55567, #46370

Tools

  • Further automate backporting from Gutenberg to Core – #55642

Upgrade/Install

  • Prevent DB errors caused by web fonts API – #55632

Users

  • Validate WP_User_Query‘s fields argument – #53177

Widgets

  • Fix Classic Widgets screen toggle response on small screens – #48896

Props

Thanks to the 55 people who contributed to WordPress Core on Trac last week: @SergeyBiryukov (20), @aristath (15), @justinahinon (14), @poena (14), @jrf (14), @costdev (8), @peterwilsoncc (6), @zieladam (5), @hellofromTonya (4), @audrasjb (3), @sabernhardt (2), @hellofromtonya (2), @desrosj (2), @mamaduka (2), @antonvlasenko (2), @dlh (2), @darerodz (2), @ndiego (2), @pbiron (2), @afragen (2), @manooweb (2), @spacedmonkey (2), @pbearne (2), @kebbet (1), @kjellr (1), @azouamauriac (1), @inc2734 (1), @jffng (1), @gziolo (1), @bph (1), @jonoaldersonwp (1), @adamsilverstein (1), @kmix39 (1), @Boniu91 (1), @genosseeinhorn (1), @sergeybiryukov (1), @mat-lipe (1), @mjkhajeh (1), @felipeelia (1), @mukesh27 (1), @TimothyBlynJacobs (1), @johnbillion (1), @ntsekouras (1), @grandeljay (1), @Spacedmonkey (1), @chouby (1), @konradyoast (1), @timothyblynjacobs (1), @volodymyrkolesnykov (1), @sumitsingh (1), @mikeschroder (1), @bernhard-reiter (1), @czapla (1), @janh2 (1), and @azaozz (1).

Congrats and welcome to our 4 new contributors of the week: @kmix39, @genosseeinhorn, @mjkhajeh, @grandeljay, @janh2 ♥️

Core committers: @sergeybiryukov (32), @peterwilsoncc (10), @johnbillion (8), @audrasjb (7), @gziolo (5), @hellofromtonya (3), @desrosj (3), @spacedmonkey (1), @mikeschroder (1), @jffng (1), and @davidbaumwald (1).

#6-0, #core, #meta6273, #week-in-core