The WordPress coreCoreCore is the set of software required to run WordPress. The Core Development Team builds WordPress. development team builds WordPress! Follow this site for general updates, status reports, and the occasional code debate. There’s lots of ways to contribute:
Found a bugbugA bug is an error or unexpected result. Performance improvements, code optimization, and are considered enhancements, not defects. After feature freeze, only bugs are dealt with, with regressions (adverse changes from the previous version) being the highest priority.?Create a ticket in the bug tracker.
This post offers a proposal to create a private slackSlackSlack is a Collaborative Group Chat Platform https://slack.com/. The WordPress community has its own Slack Channel at https://make.wordpress.org/chat/. channel (#performance-hosting) where members of both the Performance Team and relevant representatives from hosting companies can come together to share information impacting the performance of sites, test relevant PRs, and have a quick feedback loopLoopThe 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. for any performance regressions in new releases. This builds on the current private #security-hosting channel that’s already in place and has proven to be an area of collaboration.
Background
In talking to folks last week at WCUS alongside @harishanker, it became clear that in some cases hosting companies would benefit from a more curated and focused space for contribution that aligns with areas where they can make the biggest impact. In talking with folks, the following areas came to mind: performance, infrastructure, support, and security. This was a repeated topic in all conversations and, in these conversations, the #security-hosting channel came up as an already functional pathway.
Format
Create a new private slack channel for #performance-hosting that includes members from the Performance team for monitoring and engagement alongside relevant members from hosting companies. This is private in order to allow for more sharing and it’s centered around performance in order to provide a curated path for contribution, bringing in folks from the Performance team to engage directly.
What will this group work on?
Below are some of the ideas that were shared in the conversations. See these are starting ideas and not entirely encompassing:
Share anonymized data around plugins that are impacting sites the most in order to do outreach to them with performance suggestions, see what we can learn from them to improve CoreCoreCore is the set of software required to run WordPress. The Core Development Team builds WordPress., and update the plugin checker for anything that might be missing to help future contributors.
Share common user configuration to provide better tests for real world performance situations, rather than solely relying on lab metrics.
Test performance PRs early.
Create a tight feedback loop after releases for any performance degradations.
Why performance?
It’s clear there are a specific areas that hosts are best equipped to make the biggest impact and contribution, including performance. At the same time, the Performance team is a strong team with a clear roadmap, sponsored contributors, and a dedicated space already. In my time in the FSE Outreach Program, I found out how critical it is to create a space that’s managed, maintained, and specific. This checked all the boxes and I anticipate there will be more areas that will, like Support.
Why a private channel?
In talking to folks, a private channel came up as a safer space to share information. I am not personally opposed to a public channel but I want to recognize the reality that for folks in the hosting space, it felt advantageous to have private.
What do you all think? Please share by October 9th, 2024.
Please share your thoughts below. While there was an appetite for this idea when talking to folks in person, I want to know what blockers there might be and whether there are reasons not to pursue this, especially from the Performance team who will be impacted by this.
Currently there is no easy way to identify TracTracAn open source project by Edgewall Software that serves as a bug tracker and project management tool for WordPress. tickets specifically for adding unit tests. Some are added to the Build/Test Tools component, however the tests are not really “tools”. The reason for this is that unit tests, just like build and test tools, are “non-production code”. That means they can be committed at any time during the WordPress development cycle and do not follow the general milestones-based workflow.
Additionally, many tickets for adding unit tests are marked as “enhancements”. Following the release cycle workflow, enhancements cannot be committed during betaBetaA 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. and RCrelease candidateOne 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).. However, in practice unit tests can be committed at any time. It can be difficult to isolate these today, as the Trac search form lacks a filterFilterFilters 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. for such tickets, which makes triaging a bit harder.
Some suggestions
During the discussion in #core, several ideas were proposed about how this can be made to work better. And while there isn’t currently much traction on adding E2E tests to CoreCoreCore is the set of software required to run WordPress. The Core Development Team builds WordPress., any option explored should take this test type into account. In no particular order:
Component: A new Tests component, which would be exempt from the general workflow, similar to Build/Test Tools. Example component filter.
Keyword: A tests-only keyword to identify that it’s for unit/E2E tests only, and serve to filter tickets for triagetriageThe act of evaluating and sorting bug reports, in order to decide priority, severity, and other factors. reports. Example keyword filter.
Milestone: An Any Time milestone could indicate when this type of ticketticketCreated for both bug reports and feature development on the bug tracker. could be committed, being primarily reserved for tests- and docs-only tickets. Example milestone filter.
Type: A test ticket type, to clearly differentiate from the current defect (bug), enhancement, and task (blessed) types. Example type filter.
Type (alternative): A new non-production type could be introduced to broadly cover any ticket that does not affect build/production code. Example type filter.
I think that any of the proposed solutions would make searching and triaging test-oriented tickets a bit easier. Some are more flexible in that it’s easier to combine terms (focuses and keywords).
What are your thoughts on these ideas to make test-only tickets easier to distinguish? Please help continue the discussion in the comments below!
WordPress 6.7 introduces a new @wordpress/a11y script module and a new APIAPIAn 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. to pass script module data from the server to the client.
Hello all, I must first preface this by saying this is not a post to get into the specifics of what’s going on with the community right now.
I am no longer contributing to WordPress as things stand. As a result of me stepping down, we need new leadership to take Fields APIAPIAn 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. to where it needs to be for WordPress coreCoreCore is the set of software required to run WordPress. The Core Development Team builds WordPress..
I have believed over the past decade that we need a Fields API within WordPress itself. I still believe this and many others do too. I’m hopeful someone will step up and hop into the #core-fields channel on the .org SlackSlackSlack is a Collaborative Group Chat Platform https://slack.com/. The WordPress community has its own Slack Channel at https://make.wordpress.org/chat/. to continue coordinating things from where they are. We need someone with passion and the ability to bring everyone to the table.
The vision as it was during WCUS week before things got sidetracked:
Data Views are awesome and there are things like the PHPPHPThe web scripting language in which WordPress is primarily architected. WordPress requires PHP 5.6.20 or higher DataKit which prove how we can build upon them without leaving many PHP developers behind
Data Forms are really just getting started in core / GutenbergGutenbergThe 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/ and it’s important that work is done to open them up to consume configurations from JSONJSONJSON, 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. or the REST APIREST APIThe 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/. for screens
Both Data Views and Data Forms will eventually spread across the rest of the UIUIUser interface like the User edit screen and plenty of other forms — this means the Fields API itself will be spread everywhere if we become integrated properly
We should start with the Quick Edit experience which is currently an experiment in Gutenberg you can enable
We should offer a PHP API to register ‘forms’, ‘sections’, and ‘fields’ for those forms — however we get there
We should include those registered configs in the REST API for the post type
A great deal of research was done originally and Fields API has been through a number of concepts:
There’s so much more I wish I could share in my vision on this and spend lots of time with images + video screencast showing you through what I was extremely excited about at WCUS.
Finally, I want to say thank you to everyone who believed in me and the project. Thank you to many of the Gutenberg contributors who spent their time with me at WCUS contributor dayContributor DayContributor Days are standalone days, frequently held before or after WordCamps but they can also happen at any time. They are events where people get together to work on various areas of https://make.wordpress.org/ There are many teams that people can participate in, each with a different focus. https://2017.us.wordcamp.org/contributor-day/https://make.wordpress.org/support/handbook/getting-started/getting-started-at-a-contributor-day/. unblocking our overall goal. They were on board with this. I will always be a fan of those contributors doing their best to make WordPress better.
We were so close here, I believe that if someone steps up then we could see some semblance of a Fields API finally committed to WordPress 6.8. I just won’t be there to enjoy the fruits of that labor.
Goodbye everyone, but I won’t be that far away. I’ll be rooting for those of you making WordPress the best it can be and choosing your own paths going forward. Who knows what the future holds, I may return one day in the future if circumstances change for me personally.
DataViews and DataForm have been the foundation of the overall admin design efforts, for now, visible in the site editor. PluginPluginA 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 agency developers can already start using the components for their WordPress customizations.
The `DataForm` API was introduced in GutenbergGutenbergThe 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/ 18.8 as part of a larger effort to reduce duplicated form code in Data Views. Work has continued over the last few releases, and Gutenberg 19.4 added support for the `combinedFields` layout, enabling multiple fields to be rendered in the same row.
Join this informal discussion and learn about the work in progress. Zoom link will be shared in the #outreachSlackSlackSlack is a Collaborative Group Chat Platform https://slack.com/. The WordPress community has its own Slack Channel at https://make.wordpress.org/chat/. channel and in a comment on this post on Oct. 23, 2024
GitHubGitHubGitHub is a website that offers online implementation of git repositories that can easily be shared, copied and modified by other developers. Public repositories are free to host, private repositories require a paid subscription. GitHub introduced the concept of the ‘pull request’ where code changes done in branches by contributors can be reviewed and discussed before being merged be the repository owner. https://github.com/ issues for context:
WordPress 6.7 is set to be released on November 12th, 2024. Along with a new default theme, there are new features, like the ability to zoom out to compose content with patterns, and new APIs, like the Template Registration APIAPIAn 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.. More than anything though, this release brings refinement to how everything connects together to create a more seamless WordPress experience, whether you’re trying to upload an HEIC image to your site or display a selection of posts with the Query LoopLoopThe 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.blockBlockBlock 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..
As always, what’s shared here is being actively pursued, but doesn’t necessarily mean each will make it into the final release of WordPress 6.7.
For a more detailed look at the work related to the block editor, please refer to the 6.7 board and review the currently open Iteration issues. After a recent organization effort, Iteration issues are meant to reflect active work that’s been scoped down for a major releasemajor releaseA 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.. To get a sense of some of what’s being worked on both for this release and beyond, check out the demos shared in a recent hallway hangout.
New default theme
6.7 marks the next edition of a default WordPress theme, designed to showcase the latest in WordPress and set a new standard for block themers. This year the theme seeks to be the ultimate use case for a spectrum of bloggers: simple blogs, suitable for personal blogs like ma.tt; photo blogs, tailored primarily for photography or portfolios, and complex blogs, suitable for websites that require a wider set of blocks, with more complexity in content, like a news site.
The Query Loop block is one of the more powerful and complex blocks in the site building experience. While it’s important for the block to be robust in what it can accomplish, it also needs to strike the balance of being intuitive to customize. From reviewing the block’s settings copy to improving the context detection, the Query Loop is being intentionally revisited and improved.
With patterns getting more feature-rich and pervasive, the option to zoom out to edit and create at the pattern level over granular block editing is underway. This effort aims to provide a new, high-level approach to building and interacting with your site, with several key features in development:
A zoomed out experience in the editor when inserting patterns to facilitate high level overview of the site.
A zoomed out experience when adding a new page that emphasizes patterns.
Ability to manipulate patterns in the template via moving, deleting, etc while zoomed out, including a new vertical toolbar.
Improvements to UXUXUser experience for dragging patterns (e.g. vertical displacement).
Option to toggle zoom out on and off in the preview panel.
Option to enter and exit editing at the block level when zooming out.
Adding and interacting with media is taking a big leap forward in this release with HEIC support, auto sizes for lazy loaded images, and more background image support at an individual and global level:
View metaMetaMeta 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. boxes in the iframed Post Editor
Previously, after an effort to iframe the post editor, meta boxes prevented the editor content from loading in an iframeiframeiFrame is an acronym for an inline frame. An iFrame is used inside a webpage to load another HTML document and render it. This HTML document may also contain JavaScript and/or CSS which is loaded at the time when iframe tag is parsed by the user’s browser., causing a fair amount of disruption and workarounds. To resolve this and ensure that both metaboxes and canvas content is visible when working on content, a split view is being implemented to allow you to access both. This change will provide a consistent WYSIWYGWhat You See Is What You GetWhat You See Is What You Get. Most commonly used in relation to editors, where changes made in edit mode reflect exactly as they will translate to the published page. experience between the Editor and frontend views.
Review the PR introducing this change for more information.
Design tools
Consolidating and expanding block supports
Various blocks are loaded up with more supports to achieve ever more designs with a special shout out to the long requested shadow support on Group blocks for designers and themers alike:
Buttons: Add border, color, and padding block supports. (63538)
Post ExcerptExcerptAn excerpt is the description of the blog post or page that will by default show on the blog archive page, in search results (SERPs), and on social media. With an SEO plugin, the excerpt may also be in that plugin’s metabox.: Add border support (64022)
Term Description: Add border block support (63630)
Verse block: Add background image and minimum height support (62498)
Edit and apply font size presets
The Styles interface introduces an enhanced feature for creating, editing, removing, and applying font size presets allowing users to easily modify theme provided presets and provide custom options. For each preset, custom or otherwise, this also includes the ability to toggle on fluid typography for baked in responsiveness with the option to set custom fluid values.
To ensure confidence in using typography block supports for extenders, work is underway to stabilize these options by removing their _experimental status.
A new API is set to land for WordPress 6.7 to streamline registering templates and template parts for the many plugins that register their own. Previously, plugins needed to rely on several filters to get started, adding a barrier of entry and adoption. With this new API, there will be a more seamless extension experience for developers that aligns with what users have come to expect when interacting with templates and template parts.
Review the PR introducing this API for more information.
Preview Options API
A new API seeks to extend the Preview dropdown menu in the post/page editor allowing plugins to add custom menu items to the Preview dropdown. This extension point allows for greater flexibility in preview functionality, enabling pluginPluginA 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 developers to integrate custom preview options seamlessly into the WordPress editor with the following key features:
Introduces PreviewDropdownMenuItem component for adding custom items to the Preview dropdown
Allows plugins to add menu items with custom titles and click handlers
Maintains the existing Preview dropdown structure while allowing for extensibility
Review the PR introducing this API for more information.
Interactivity API
In WordPress 6.7, work will continue on internal improvements to ensure that the Interactivity API’s code is as simple and stable as possible and to make the Interactivity API resilient when used asynchronously (e.g., adding directives or stores after initialization). This will pave the way for performance improvements such as directive code splitting or lazy loading of interactive blocks. Finally, efforts are underway to add more built-in functionality to current blocks, starting with adding lightbox support to the Gallery block.
The Block Bindings API launched in 6.5 and iterated upon in 6.6 allows you to bind dynamic data to block attributes, solving many use cases for custom blocks and powering other features, like overrides in synced patterns. After the 6.6 iteration, several dedicated areas of work are underway with a key focus around adding a user interface (UI) that allows users to connect attributes with their binding sources, making it possible to create bindings through the UI instead of the Code Editor. The block bindings editor’s APIs also need refinement to be more accessible for external developers, as some coreCoreCore is the set of software required to run WordPress. The Core Development Team builds WordPress. sources, like “Post Meta,” currently use private APIs to manage bindings. Testing support for additional core sources will help ensure the editor APIs are flexible enough for future needs. There is also work needed to support new features related to pattern overrides.
HTMLHTMLHyperText Markup Language. The semantic scripting language primarily used for outputting content in web browsers. API
Building on recent iterations, the HTML API is focused on improving support across blocks to increase confidence in markup manipulation on the server for block rendering, while ensuring seamless integration with the interactivity API. Efforts are also underway to complete the “IN BODY” insertion mode, initiated in version 6.6, to support most tags in various situations. This work is essential to prepare the HTML Processor for reliable use with any HTML document, allowing Core to build on it without concerns about failures. Feature development is currently aimed at enhancing the CSSCSSCascading Style Sheets. selector interface by adding querySelector() or a similar method to the HTML API, which is crucial for sourcing block attributes. Additionally, efforts continue on the Server Directive Processor and the replacement of block bindings to rely more on the HTML Processor instead of the Tag Processor.
Continuing to improve PHPPHPThe web scripting language in which WordPress is primarily architected. WordPress requires PHP 5.6.20 or higher 8.x support
To continue improving support for PHP 8.x, code specific to prior PHP versions that are no longer supported have been removed.
Find something missing? Want to help?
If you have something you’re working on that you don’t see reflected in this post, please share a comment below so we can all be aware! If you’re reading this and want to help, a great place to start is by looking through each issue associated with each area or by diving into the Polish board where a curated set of issues are in place that anyone can jump in on.
Changelog:
September 5th: removed mention of quick edit from Data Views section.
It’s time to get WordPress 6.7 ready for release, and help is needed to ensure it’s smooth and bugbugA bug is an error or unexpected result. Performance improvements, code optimization, and are considered enhancements, not defects. After feature freeze, only bugs are dealt with, with regressions (adverse changes from the previous version) being the highest priority.-free. Whether you’re an experienced contributor or joining in for the first time, everyone is welcome at our bug scrubs! 🎉
Schedule Overview
Regular bug scrubs are being held every week leading up to the WordPress 6.7 release, with some cases including two sessions a day to cover a broader time frame. As the release date approaches and activity ramps up, the number of scrubs may be increased if necessary. These efforts will help ensure everything is on track for a smooth launch. Participation is welcome at any of these sessions, so feel free to join. Bring questions, ideas, and let’s scrub some bugs together!
These “CoreCoreCore is the set of software required to run WordPress. The Core Development Team builds WordPress. Editor Improvement…” posts (labeled with the #core-editor-improvementtagtagA 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.)) are a series dedicated to highlighting various new features, improvements, and more from Core Editor related projects.
Various improvements to font management, including managing font size presets and refinements to the Font Library experience, are coming to WordPress 6.7. Taken together, expect more control over your fonts and an easier time using them exactly as you want. Below is a video showcasing some of these new options and improvements:
Edit and apply font size presets
Create, edit, remove, and apply font size presets with a new addition to the Styles interface. You can now modify presets provided by a theme or create your own custom options. A key feature is the ability to toggle fluid typography, which enables responsive font scaling, with the option to set custom fluid values for finer control over responsiveness. Of note, individual font sizes may opt out of fluid typography if it is turned on globally and vice versa, ensuring more flexibility.
Alongside these overall improvements and new functionality, the Styles interface has been refined to make applying site-wide font changes more discoverable. Namely, the font presets, along with the color presets, are now available to select between from the Styles sidebarSidebarA sidebar in WordPress is referred to a widget-ready area used by WordPress themes to display information that is not a part of the main content. It is not always a vertical column on the side. It can be a horizontal rectangle below or above the content area, footer, header, or any where in the theme. under the “Browse styles” option. The Font Library is also better surfaced whether you’ve added fonts or not. The aim is to ensure high level font options are right where you want them with more advanced customization options available for anyone who wants to go a step further.
WordPress’s HTMLHTMLHyperText Markup Language. The semantic scripting language primarily used for outputting content in web browsers.APIAPIAn 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. is developing at a rapid pace. Introduced in WordPress 6.2, and expanded in each release since, the HTML Processor is expected to support all HTML inputs1 in WordPress 6.7. What does this mean for you and where does development go once “full support” has been reached?
The HTML Processor also gained a new constructor method: create_full_parser(). The full parser expects an HTML document in its entirety, including the doctype declaration, <html>tagtagA 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.), and all. The existing mechanism, create_fragment(), assumes that the given input exists within an existing HTML context, such as inside a <body> tag. If you’ve ever wondered by DOMDocument creates an HTML and HEAD element even when none exists, it’s because it’s performing a full document parse. While both methods have their place, create_fragment() is probably still what you want to use because WordPress rarely presents a complete HTML document to its functions, plugins, and themes.
All supported tags, but with a caveat
There are a few situations that the HTML Processor still won’t support for WordPress 6.7. These are cases where nodes are supposed to be re-parented and they have remained an obstacle for the past few releases. The problem isn’t knowing how to parse these situations, but rather that they imply that parts of a document have changed after the processor has already seen them. They occur most frequently when formatting elements are implicitly closed and then need to be re-opened and when content inside a TABLE element is not in a cell. Such can be seen with the following HTML:
<table><td>1</td>2
This looks innocent enough, but the 2 belongs in front of the TABLE element. When nodes are moved around after the fact like this, it’s possible that the parser might have seen hundreds of kilobytes of content in the meantime. This disconnect between the order of the HTML text and the traversal order in the DOM tree raises complicated questions, including for situations where inner markup is being modified.
A cursory analysis of high-ranked domains on the broader internet suggests that around 1% of real web pages involve these and other unsupported situations. Luckily, most content within WordPress and all content generated by frameworks like ReactReactReact is a JavaScript library that makes it easy to reason about, construct, and maintain stateless and stateful user interfaces. https://reactjs.org/. avoid these invalidinvalidA 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. HTML constructions.
Reading and modifying inner HTML
One question that has delayed the introduction of methods like set_inner_html() is how to know whether content is already escaped or not. Can a system be built that allows “trusted” input without introducing opportunities for vulnerabilities? With the expansion of support and the unlocking of new fragment parser contexts, there’s finally a way forward to address this question: do what a browser does.
To set inner content, the HTML Processor will create a new fragment parser using the current element as the context element. It will run the fragment parser to its end and transfer the parsed nodes into the target, just like node.innerHTML = 'string of <code>HTML</code>' in the DOM does. This approach seems obvious from some angles, but implies that the HTML API will be parsing (and possibly re-parsing) any contents that are being set into a target document – this is a slower approach than naïvely slicing in new HTML.
This approach has a fascinating upside though: in addition to ensuring that content is properly escaped, it will normalize the content and prevent the new HTML contents from escaping its outer node. It properly isolates HTML updates. For example, suppose one wants to set the inner HTML for a DIV element.
What should happen with the </div>? If the HTML API were simply replacing text or concatenating HTML, then the update would close the open <div> and the “ do?” content would now appear outside of the intended spot.
// Broken by string concatenation unaware of HTML.
<main><div>What will </div> do?</div></main>
Since the HTML API creates a fragment parser in the appropriate context, however, when it finds the </div> token it will realize that there’s no open <div> and ignore the token (note the extra space below, which in a browser will collapse into single space). The content will remain inside the original DIV.
<main><div>What will do?</div></main>
Things can appear fairly wacky at times, but the normalization process will leave the HTML better than when it found it.
Modifying HTML content mostly depends on being able to create a new fragment parser in the context of the current element. Since this is an ongoing project it will not likely make it into WordPress 6.7, but should be available early in the 6.8 development cycle.
Review of all CSSCSSCascading Style Sheets. semantics
The job of the HTML API is to know all of the minute details of HTML parsing so that you don’t have to. To that end, all of the CSS-related methods have been audited to ensure that they reliably match the behavior in a browser. This mostly involved examining the impact of “quirks mode,” which determines if class selectors match names in a case sensitive manner or not.
So if you ask whether CSS class names are matched case-sensitively or not then the HTML API will answer based on the HTML document it was provided. The Tag Processor and fragment parser will assume no-quirks mode (standards mode) while the full parser will choose based on the rules in the HTML specification.
What’s coming after reaching full tag support?
Continuing towards 100%
Parsing HTML involves no uncertainly: WordPress needs to understand all possible HTML documents. In the coming releases work will continue on the tricker design details of supporting the final unsupported bits.
In some situations an element is found outside where it should be. For example, a <p> tag might appear after a BODY element is closed, but it belongs inside the BODY element. The HTML Processor could report this at the proper breadcrumbs (because it knows it belongs at HTML > BODY > P), but that would appear as though the parser jumped backwards in the document back into the BODY. A document should only ever open and close the BODY once. Whether it’s an errant <meta> tag, a <script> after the BODY, or an HTML comment after the BODY, these situations account for about half of the situations that aren’t supported.
The other half of the unsupported situations are more complicated. They involve things which are easy in the DOM but hard in HTML. Specifically, there are times where elements get moved up higher in the tree, or earlier, or are duplicated in different parts of the tree. The HTML API knows where these elements should move, but it doesn’t know until after it has parsed and moved on from those places. It may be possible to look ahead in the document and rearrange the virtual sequence in the HTML, but this is a complicated and delicate operation that requires lots of care.
However these situations are handled, they will probably be done so in an opt-in manner. Lookahead might resolve the problem of accurately representing the document, but in some extreme cases, it may be required to fully parse the entire document before returning control to the calling code. Potentially there could be a user-selectable amount of lookahead before the processor gives up, and a small default value could strike a good balance between fully-supported parsing and surprise performance behaviors.
$processor->set_allowable_lookahead( 3 )
These unsupported situations present some design issues that also need to be solved when discussing modification of an HTML document. For example, in cases where formatting elements are reconstructed, if some code adds a new attribute to the real formatting token then the attribute value appears also on all of the recreated versions of it. How should the HTML API know if someone wanted to set an attribute only on the first element or if they wanted to set it also on all reconstructed elements?
In some cases this can all be avoided by using the HTML API to normalize a document before processing, but in other cases these questions need to be explored before making any hasty decisions. Supporting out-of-order elements makes reading and writing inner HTML significantly more complicated because it can’t return a simple substring; while auto-fixing could invoke catastrophic backtracking into the parser.
Reading sourced blockBlockBlock 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. attributes on the server
Although this feature has also been pushed back a couple of releases the work continues. There wasn’t sufficient HTML support in WordPress 6.6 to allow reading block attributes reliably enough to be usable. With the practically-complete support in WordPress 6.7 this will no longer be a problem. The primary challenge now is building an interface to parse a CSS selector in a way that properly translates into HTML API code.
When this work was first explored it relied on the Tag Processor and started searching in a top-down manner based on the selector. This isn’t the most efficient way to search, however. In rebuilding the block attribute sourcer for the HTML Processor, the parsing of the CSS selector is going to need to figure out how to search in a bottom-up manner. It’s also going to need to pay attention to things like class names, attribute values, and nth-child counts for relevant tokens while parsing.
WordPress Bits
WordPress 6.7 is not going to see any major work on the Bits proposal, but the work is still being actively pursued. Other developments on templating, custom data types/fields, and block bindings continues to explore the space from the UIUIUser interface and UXUXUser experience angle.
Native PHPPHPThe web scripting language in which WordPress is primarily architected. WordPress requires PHP 5.6.20 or higher support
The HTML API will be significantly faster when it’s available in PHP, written in C instead of user-land PHP. The first proposal to move the HTML API into PHP itself is in the RFC process, adding a decode_html() function corresponding to the recently-introduced WP_HTML_Decoder class.
Additional notes
An HTML API debugger makes exploring HTML fun
@jonsurrell built a WordPress plugin to add a visual HTML API debugger in wp-admin and it’s built with the Interactivity API. This is a fun tool that shows how the HTML API parses a given HTML input. In addition, it provide insight into the parsing mechanics that lead to the final structure. One can learn a lot about HTML parsing just by seeing how different inputs are processed. For example, the “virtual” nodes in the output represent tags that weren’t in the HTML text but were implicitly created based on HTML’s parsing rules.
Following the progress
For updates to the HTML API keep watch here for new posts.
If you want to follow the development work you can review Trac tickets in the HTML API component or start watching new HTML API tickets from the component overview page. If you want to talk details or bugs or applications, check out the #core-html-api channel in WordPress.orgWordPress.orgThe community site where WordPress code is created and shared by the users. This is where you can download the source code for WordPress core, plugins and themes as well as the central location for community conversations and organization. https://wordpress.org/SlackSlackSlack is a Collaborative Group Chat Platform https://slack.com/. The WordPress community has its own Slack Channel at https://make.wordpress.org/chat/..
“All” is mostly correct, because while all HTML tags are supported, there are still situations that account for around 1% of all HTML documents on the internet that get into edge cases that it can’t parse. These cases all deal with content that’s found outside of the place it should be, where the tree-order of the nodes in a DOM are rearranged from the order in which the HTML tags are found. The HTML Processor still aborts parsing when it encounters unsupported markup, so it should continue to be reliable for everything it supports. ↩︎
The theme.jsonJSONJSON, 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. version is incremented whenever a breaking change would need to be made to the APIAPIAn 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.. This allows consumers to opt-in to the breaking change by updating the version. Older theme.json versions will always be supported in the latest versions of WordPress.
Updating to version 3 is recommended when your minimum supported WordPress version reaches 6.6. See theme.json version 3 frequently asked questions for more information on when to update. Then check out the theme.json reference for migrationMigrationMoving the code, database and media files for a website site from one server to another. Most typically done when changing hosting companies. instructions when you are ready to update.
Breaking changes in version 3
Starting with theme.json version 3 the default behavior for using the same slugs as the default fontSizes and spacingSizes presets has been changed to match how other theme.json presets work: from always overriding the default presets to requiring defaultFontSizes or defaultSpacingSizes to be false in order to override the default presets.
Default font sizes
settings.typography.defaultFontSizes is a new option in theme.json v3. It controls whether the coreCoreCore is the set of software required to run WordPress. The Core Development Team builds WordPress. provided default settings.typography.fontSizes presets are shown and used.
The default fontSizes presets’ slugs are: small, medium, large, and x-large.
When defaultFontSizes is true it will show the default font sizes in the editor and prevent the theme from creating presets using the default slugs.
When defaultFontSizes is false it will hide the default font sizes in the editor and allow the theme to use the default slugs.
For blockBlockBlock 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. themes defaultFontSizes is true by default. This is consistent with how other default* options work such as settings.color.defaultPalette.
For classic themes there is a new theme support default-font-sizes which is also true by default. However, unlike block themes, it is set to false when editor-font-sizes theme support is defined.
In theme.json v2, the default font sizes were only shown when theme sizes were not defined. A theme providing font sizes with the same slugs as the defaults would always override the defaults.
To keep behavior similar to v2 with a v3 theme.json:
If you do not have any fontSizes defined, defaultFontSizes can be left out or set to true.
If you have some fontSizes defined, set defaultFontSizes to false.
settings.spacing.defaultSpacingSizes is a new option in theme.json v3. It controls whether the core provided default settings.spacing.spacingSizes presets are shown and used.
The default spacingSizes presets’ slugs are: 20, 30, 40, 50, 60, 70, and 80.
When defaultSpacingSizes is true it will show the default spacing sizes in the editor and prevent the theme from creating presets using the default slugs.
When defaultSpacingSizes is false it will hide the default spacing sizes in the editor and allow the theme to use the default slugs.
defaultSpacingSizes is true by default. This is consistent with how other default* options work such as settings.color.defaultPalette.
For classic themes there is a new theme support default-spacing-sizes which is also true by default. However, unlike block themes, it is set to false when editor-spacing-sizes theme support is defined.
In theme.json v2, the default spacing sizes were only shown when theme sizes were not defined. A theme providing spacing sizes with the same slugs as the defaults would always override the defaults.
Furthermore, there are two settings that can be used to set theme level spacing sizes: spacingSizes and spacingScale. With theme.json v3, presets from both will be merged together and sorted numerically by slug. Presets defined in spacingSizes will override those generated by spacingScale if the slugs match.
In theme.json v2, setting both spacingSizesandspacingScale would only use the values from spacingSizes.
To keep behavior similar to v2 with a v3 theme.json:
If you do not have any spacingSizes presets or spacingScale config defined, defaultSpacingSizes can be left out or set to true.
If you disabled default spacing sizes by setting spacingScale to { "steps": 0 }, remove the spacingScale config and set defaultSpacingSizes to false.
If you defined only one of either spacingScale or spacingSizes for your presets, set defaultSpacingSizes to false.
If you defined both spacingScale and spacingSizes, remove the spacingSizes config and set defaultSpacingSizes to false.
You must be logged in to post a comment.