Skip to content

Dev Notes Tracking Issue for WordPress 6.0 #39654

Closed

Description

@bph

Description

For WordPress 6.0, a GitHub project is being used to track dev notes and their progress. You can find the dev notes project view here - WP 6.0 Documentation (view)

Please share your notes here as comments or a link to a shared Google document. The WordPress 6.0 Documentation team (@zzap, @abhansnuk @aurooba and I, @bph) will be happy to assist in wording and scope.

If your note is ready to be posted on Make Blog and you have privileges, then go ahead and post it in draft, we can wrangle the reviews.

The dev notes should start latest with Beta 1, but you can certainly start now.
Deadline is before WP 6.0 RC (May 2nd, 2022) - You don't have to wait for the last minute to get it done, thought. 😘

⭐️ Handbook Page: Writing developer notes

Please leave a comment, also if you're unable to write a note for your PR or if you need assistance.

I'll start connecting with PR authors 1:1 to double-check availability, and see if I can unblock things.
👍 (saw it and Thank You! ) 🚀 (in review)

Theme Export

Lock Settings


** Updates 4/29/2022**
#39950 didn't not in WP6.0
#38780 experimental API (no documentation)
#38397 -> Field Guide: But Wait section.
#36811 (already in 5.9)
#38663 @oandregal (bug fix only)

Updates 4/14/2022
## WebFonts API - probably won't make it into 6.0 as it wasn't merge by Beta 1 (Feature Freeze) (discussion in release leads channel)

#36176 @gziolo @aristath - won't be in 6.0 (comment)

Activity

  1. added
    [Type] Tracking IssueTactical breakdown of efforts across the codebase and/or tied to Overview issues.
    on Mar 22, 2022
  2. added this to the milestone on Apr 5, 2022
  3. adamziel commented on Apr 6, 2022

    @adamziel
    Contributor
  4. adamziel commented on Apr 6, 2022

    @adamziel
    Contributor

    Here's a data module related dev note, if there are more data module dev notes, they could potentially be grouped together in a post.

    Data Module

    Support for Handling Resolution Errors

    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 core 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( 'Network error' )

    The error details may be retrieved using the hasLastResolutionFailed, getLastResolutionFailure, and getResolutionState` meta-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.

  5. removed this from the milestone on Apr 7, 2022
  6. scruffian commented on Apr 7, 2022

    @scruffian
    Contributor

    Theme Export

    The "Export" feature in the Site Editor has been improved so that now you can export your whole theme, including all the edits you have made to your templates and styles. Previously the export function only gave you access to your template files. This change makes it possible to build a block theme using the site editor and easily share the zip file with anyone.

    The Export process

    The export process copies all files from the current theme into a zip file. Then it extracts the template changes that are stored in the database to files and adds them to the zip file. If these template have the same names as those in the theme, they will be overwritten, so that the database version take precedence. The same process happens for the theme.json file. There are three directories that are excluded from the export: .git, node_modules and vendor.

    Unexpected changes

    The export process may make a few unexpected changes to your templates and theme.json files.

    1. The output of template files from the database will be sanitized for security reasons. You're most likely to notice this with any CSS variables in your template files: e.g. --wp--custom--spacing--outer would become \u002d\u002dwp\u002d\u002dcustom\u002d\u002dspacing\u002d\u002douter.
    2. The properties in theme.json are now sorted alphabetically, so the first time you export you might notice some of the objects in your theme.json move position. This now gives us a standard order for these properties so in future it will be easy to know where everything should go.
    3. The schema may be updated - the export will update your theme.json schema to match the version of WordPress you are using, so if you theme was created with an older version of WordPress, the schema will be updated to match the version you are on.

    How to submit a theme

    Once you have your exported theme, you may need to make several changes before you can submit it to the theme repository.

    1. The screenshot will need to be updated, if you've made any visual changes to the homepage.
    2. You will need to add a changelog entry to the readme.txt file.
    3. You will need to update the version number of the theme in style.css.
    4. If this is a new theme, based on an existing theme, you will also need to update the name.
    5. If the theme doesn't have a license file already you will need to add one.
    6. You will then need to rezip the theme with these changes.
    7. You can now submit the new zip file to https://wordpress.org/themes/getting-started/.

    We're looking forward to seeing more block theme submissions!

  7. glendaviesnz commented on Apr 8, 2022

    @glendaviesnz
    Contributor

    Gallery block

    Ability to adjust gap between images added

    In order to implement this the spacing of the Gallery images had to be changed from a right margin setting to the CSS 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 so 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 );
    }
  8. glendaviesnz commented on Apr 8, 2022

    @glendaviesnz
    Contributor

    Separator block

    Updated to use block supports color settings

    In order to allow the setting of a custom opacity for each block the Separator block has been updated to use the block supports color settings. The custom opacity can then be set using the alpha channel setting of the selected color.

    separator-opacity.mp4

    The HMTL structure of the block is unchanged, and all of the existing classes are still in place, but two additional classes have been added - .has-alpha-channel-opacity and .has-css-opacity. These new classes have been added in order to maintain the default 0.4 opacity for all existing blocks in both the editor and the frontend. The opacity for existing 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 CSS can be added:

    hr.wp-block-separator.has-alpha-channel-opacity {
    	opacity: 0.4;
    }
  9. dmsnell commented on Apr 8, 2022

    @dmsnell
    Member

    Unrecognized block preservation

    #38794, #38923, #39523

    We've started making strides in preserving unrecognized content in the editor, also called (sometimes incorrectly) "invalid" or "missing." In situations where the editor is unable to validate a loaded block against its implementation we run into a number of cases where content has previously been lost or corrupted, notably when inner blocks are involved.

    Right now we're on the journey to preserving that original unrecognized content but have a lot of 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.

  10. mcsf commented on Apr 12, 2022

    @mcsf
    Contributor

    A new /patterns directory for themes

    WordPress 6.0 makes it easier for themes to define their own block patterns. Themes can now define block patterns as files in the /patterns directory:

    devnotes-patterns-directory

    Each pattern file consists of a set of plugin-style headers followed by the pattern's actual source:

    <?php
     /**
      * Title: Hello
      * Slug: my-theme/hello
      * Categories: featured, text
      */
    <main><p>Hello, world!</p></main>

    Motivation

    While all themes benefit from this API, it is especially convenient for block themes, where conventional folders like templates, template-parts and now patterns reduce the role of functions.php as a control structure. This API also paves the way for any future theme-editing tools that integrate with the block editor.

    Note that this is not a breaking change. Much like plugins, themes have been able to register block patterns since the introduction of register_block_pattern() in WordPress 5.5, and that interface is not expected to change.

    Observations

    • For now, the only format supported for these files is PHP. While a simpler HTML format has been considered, PHP offers theme developers an escape hatch, should the pattern have any special content that dynamic blocks haven't yet absorbed. For instance:
    <img src="<?php echo esc_url( get_template_directory_uri() ); ?>/assets/hello.png">
    • As a general reminder, these PHP blocks are only run upon loading the block editor in order to compute the patterns. Once inserted into a post, patterns are static.

    Supported fields

    • Title (required) (implicitly translatable)
    • Slug (required)
    • Description (implicitly translatable)
    • Viewport Width
    • Categories (comma-separated values)
    • Keywords (comma-separated values)
    • Block Types (comma-separated values)
    • Inserter (yes/no)
  11. added
    Needs Dev NoteRequires a developer note for a major WordPress release cycle
    on Apr 13, 2022
  12. gziolo commented on Apr 14, 2022

    @gziolo
    Member

    #36176 won't be included in the WP 6.0 release.

  13. ntsekouras commented on Apr 14, 2022

    @ntsekouras
    Contributor

    Dev note for Allow pattern registration from directory with theme.json #38323

    Pattern registration from Pattern Directory for themes

    With WordPress 6.0 themes can easily register patterns from Pattern Directory through theme.json. In order to do that, themes should use the new patterns top level key in theme.json.

    Within this field, themes can list patterns to register from Pattern Directory. The patterns field is an array of pattern slugs from the Pattern Directory. Pattern slugs can be extracted by the url in single pattern view at the Pattern Directory. For example in this url https://wordpress.org/patterns/pattern/partner-logos the slug is partner-logos.

    {
        "version": 2,
        "patterns": [ "short-text-surrounded-by-round-images", "partner-logos" ]
    }
    

    Noting that this field requires using the version 2 of theme.json.

  14. mirka commented on Apr 15, 2022

    @mirka
    Member

    Dev note for #37160

    I'm not sure if this warrants a Dev Note, so please feel free to cut it entirely if it doesn't meet the noteworthiness threshold!


    Removed bottom margin on LineHeightControl component

    A number of UI 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 }
    />
  15. oandregal commented on Apr 18, 2022

    @oandregal
    Member

    #36811 @oandregal

    This PR has been part of 5.9, and the corresponding devnote has been published at https://make.wordpress.org/core/2022/01/08/updates-for-settings-styles-and-theme-json/ Does that devnote need any further clarification, perhaps?

  16. 4 remaining items

  17. SantosGuillamot commented on Apr 28, 2022

    @SantosGuillamot
    Contributor

    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, avatar and more.
      • Comments Pagination: Displays next/previous links to paginated comments where this has been enabled in the comment settings in the WordPress 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 enable_post_comments_legacy_block( $metadata ) {
        if ( 'core/post-comments' === $metadata['name'] ) {
            $metadata['title'] = 'Post Comments';
    	$metadata['supports']['inserter'] = true;
        }
        return $metadata;
    }
    add_filter( 'block_type_metadata', 'enable_post_comments_legacy_block' );
  18. DAreRodz commented on May 1, 2022

    @DAreRodz
    Contributor

    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 API, like blocks that would require two or more different ancestor types simultaneously.

  19. fabiankaegy commented on May 2, 2022

    @fabiankaegy
    Member

    Allowing the registration of Blocks from within Themes

    Up until WordPress 6.0 building blocks inside plugins was the only way possible if you wanted to use block.json. And it remains to be the recommended way to do things going forward. Blocks add functionality and therefore should be built-in plugins that stay active even when the theme gets changed.

    Even with that best practice in place, there are however instances where the styling 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 comes especially true when building very purpose build custom solutions. In these cases, you had to resort to hacky approaches to get the registration of blocks within themes to work.

    This is now no longer necessary. With 6.0 the registration of blocks using block.json from within a theme technically is supported. You can use the same register_block_type function as you would inside a plugin and all the assets that you may register in the block.json file like the editorScript, style, etc. get enqueued correctly.

  20. zzap commented on May 2, 2022

    @zzap
    Member

    Adding 🎉 to published ones

  21. jorgefilipecosta commented on May 2, 2022

    @jorgefilipecosta
    Member

    Adding the dev note for page creation patterns #40034.

    Page creation patterns

    When a user creates a page, the editor starts with an empty canvas. However, that experience may not be ideal, especially since there are often possible patterns the user can use when creating a page, e.g., an about page, a contact page, a team page, etc.

    Starting with WordPress 6.0, offering a set of patterns that users can choose from to create their pages is possible.
    We added a modal that shows possible patterns that can be used on page creation:

    Screen Shot 2022-05-02 at 3 38 08 PM

    The modal appears each time the user creates a new page when there are patterns on their website that declare support for the core/post-content block types. By default, WordPress 6.0 Core does not include any of these patterns, so the modal will not appear without some of these post content patterns being added.

    Any theme or plugin can register a pattern with core/post-content block support and make the modal with the patterns appear. Here we provide a sample pattern that appears in this model.

    	register_block_pattern(
    		'my-plugin/about-page',
    		array(
    			'title'      => __( 'About page', 'my-plugin' ),
    			'blockTypes' => array( 'core/post-content' ),
    			'content'    => '<!-- wp:paragraph {"backgroundColor":"black","textColor":"white"} -->
    			<p class="has-white-color has-black-background-color has-text-color has-background">Write you about page here, feel free to use any block</p>
    			<!-- /wp:paragraph -->',
    		)
    	);
    

    Completely disabling this functionality

    By default, no modal appears because there are no post-content patterns unless a theme or plugin registers one.
    If one wants to disable the modal even if there are plugins registering post-content patterns, it is possible to do so by removing the post-content block type from all patterns, as the following code sample does:

    	$patterns = WP_Block_Patterns_Registry::get_instance()->get_all_registered();
    	foreach ( $patterns as $pattern ) {
    		if (
    			! empty($pattern['blockTypes'] ) &&
    			in_array('core/post-content', $pattern['blockTypes'] )
    		) {
    			unregister_block_pattern( $pattern['name'] );
    			$pattern['blockTypes'] = array_diff( $pattern['blockTypes'], array( 'core/post-content') );
    			register_block_pattern( $pattern['name'], $pattern );
    		}
    	}
    
  22. annezazu commented on May 2, 2022

    @annezazu
    Contributor

    For transparency, noting that I directly edited two dev notes above:

    • The style variations note to include the webfonts handler information and some examples. It would be ideal to get more eyes on this.
    • The Page creation patterns note to clean up some of the language, add a screenshot, etc.

    For the comments block note @SantosGuillamot , I'd highly recommend listing out all of the blocks going into the release rather than linking off to a GitHub issue. Might be easiest to just pull from this call for testing: https://make.wordpress.org/test/2022/04/08/help-test-the-comments-blocks-for-wordpress-6-0/

  23. SantosGuillamot commented on May 3, 2022

    @SantosGuillamot
    Contributor

    For the comments block note @SantosGuillamot , I'd highly recommend listing out all of the blocks going into the release rather than linking off to a GitHub issue.

    Thanks for the feedback, it totally makes sense 🙂 I have just updated the comment. Moreover, if I am not mistaken, the new Comments should be explained later in detail in a user-facing release note (not a dev note).

  24. zzap commented on May 3, 2022

    @zzap
    Member

    All dev notes from here are published or will be soon. Thank you to everyone who participated in making them, you are heros ❤️

  25. bph commented on May 3, 2022

    @bph
    ContributorAuthor

    Thank you so much for shouldering the crunch time effort getting everything together! You are my hero @zzap 👏🎉🦸‍♀️

  26. ryanwelcher commented on May 3, 2022

    @ryanwelcher
    Contributor

    Sorry for the delay on this @bph @zzap - this covers #38535, #39723, and #38530

    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 block 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 defined dependences, 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.

  27. Mamaduka commented on May 3, 2022

    @Mamaduka
    Member

    This general dev note for Block Locking. The other items in Lock Settings list don't need a dev note.

    Block Locking Settings

    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.

    Block 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
    	}
    }
  28. zzap commented on May 5, 2022

    @zzap
    Member
  29. bph commented on May 7, 2022

    @bph
    ContributorAuthor

    There is only on open item in this tracking issue:

    It's not necessarily a Devnote for 6.0 but while we have the attention of plugin authors, it might be good to add a note to the Misc Dev Notes section about depricated APIs for this PR as well. #37854 - See my comment

  30. bph commented on May 11, 2022

    @bph
    ContributorAuthor

    All published.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs Dev NoteRequires a developer note for a major WordPress release cycle[Type] Tracking IssueTactical breakdown of efforts across the codebase and/or tied to Overview issues.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions