WordPress 5.9 RC4

A fourth and final 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). for WordPress 5.9 is packaged to mark the code freeze before release tomorrow, January 25, 2022. 

Discover more about the process for Release Day.

The following fixes are included since Release Candidate 3 (RC3) last week:

  • Classic menus are not selectable in the existing Navigation 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.PR38168
  • Remove CustomizerCustomizer Tool built into WordPress core that hooks into most modern themes. You can use it to preview and modify many of your site’s appearance settings.’s Menus section when the block theme is active – #54888
  • Block Editor: Mark last change as persistent on save – PR36887
  • Issue in clicking “Edit styles” link in the Welcome panel#54859 / PR38123
  • Fix resizable box scrollbars in blocks – PR38123
  • Fix for the pattern preview expanding issue – PR38175
  • Allow to install/activate themes/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 which require the next WordPress version – #54882

Testing the release

You can test the WordPress 5.9 release candidate in three ways:

Option 1: Install and activate the WordPress Beta Tester plugin (select the “Bleeding edgebleeding edge The latest revision of the software, generally in development and often unstable. Also known as trunk.” channel and “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./RCrelease 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). Only” stream).

Option 2: Download the RC4 version (zip).

Option 3: When using WP-CLIWP-CLI WP-CLI is the Command Line Interface for WordPress, used to do administrative and development tasks in a programmatic way. The project page is http://wp-cli.org/ https://make.wordpress.org/cli/ to upgrade from Beta 1, 2, 3, 4, RC1, RC2, or RC3 on a case-insensitive filesystem, please use the following command sequence:

Command One:

wp core update --version=5.9-RC4

Command Two:

wp core update --version=5.9-RC4 --force

Happy testing! All welcome in the #core channel on the 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/. for the 5.9 release party on January 25! You can follow along for exact timings by watching the #5.9-release-leads channel too.

Thanks @cbringmann, @audrasjb, @desrosj, @hellofromtonya, @costdev, @marybaum, @webcommsat for contributions and proofreading of this post.

#5-9

Menus endpoints in WordPress 5.9

WordPress 5.9 adds three new 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/. endpoints to manage menus and menu locations. These menus endpoints are used the in new navigation block.

Before discussing menu endpoints, it’s worth noting how menus are currently stored. Navigation menus are stored using the nav_menu 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. and the nav_menu_item post type. A menu is stored as a term and acts like a container for a number of menu items. Menu items are stored as posts. Menus and menu items also have custom fields stored in 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. and in various options.

Accessible via /wp/v2/menus, the menus endpoint allows for performing CRUDCRUD Create, read, update and delete, the four basic functions of storing data. (More on Wikipedia.) operations on menu data. This endpoint extends the WP_REST_Terms_Controller class, mapping fields to the menus and adding functionality like auto_add, that automatically adds new pages to menus when created. A GET request includes the list of menus, but does not contain the list of menu items. To get this data, the menu items endpoint can be used.

Example output from request:

{
    "auto_add": false
    "description": "",
    "id": 36,
    "locations": ['wporg_header_subsite_nav', 'primary'],
    "meta": [],
    "name": "Navigation",
    "slug": "navigation",
}

Accessible via /wp/v2/menu-items, the menu items endpoint allows for performing CRUD operations on menu items and assigning them to menus. This endpoint extends the WP_REST_Posts_Controller class, mapping fields and adding custom functionality. Menu items can only be assigned to one menu at a time unlike other taxonomies.

Many menu items have an associated object that the menu item links to. For instance, a link to a page will have the object set to page and the object_id set to the WordPress Post ID of that page. When using this endpoint, it may be useful to get information about that linked object. For example the page’s title. This information is not included in the response by default, but the REST API has a feature to embed this information by using the _embed query parameter. For example, making a GET request to /wp/v2/menu-item/8874?_embed=true will result in the following response:

{
     "attr_title": "",
     "classes": [''],
     "description": "",
     "id": 8874,
     "invalid": false,
     "menu_order": 1,
     "menus": 363,
     "meta": {},
     "object": "page",
     "object_id": 8823,
     "parent": 0,
     "status": "publish",
     "target": "",
     "title": {rendered: 'Tickets'},
     "type": "post_type",
     "type_label": "Page",
     "url": "https://make.wordpress.org/core/reports/",
     "xfn": [""],
     "_embedded": {
              wp:menu-item-object: [
                   {
                      "author": 5286302,
                      "date": "2014-01-29T19:49:26",
                      "featured_media": 0,
                      "id": 8823,
                      "link": "https://make.wordpress.org/core/reports/",
                      "slug": "reports",
                      "title": { "rendered": "Bug Reports"},
                      "type": "page",
                   }
              ],
              wp:term: [
                    {
                       "id": 363,
                       "name": "Navigation",
                       "slug": "navigation"
                    }
              ]
    },
}

Accessible via /wp/v2/menu-locations, the menu locations endpoint returns a list of menu locations registered with the register_nav_menus function. To assign a menu to a particular location, use the menus endpoint, by passing an array of menu location keys.

Example output from request:

{
     "description": "Desktop Horizontal Menu"
     "menu": 90
     "name": "primary"
}

Batching requests

Both the menu and menu item endpoints, both support the batching of requests, introduced in WordPress 5.6. This means that more than one menu / menu item can be updates / created in a simple request to the 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..

Access Control

To access data from any of the menus endpoints, requests must be made by a logged in user with the edit_theme_options capability. By default, only users with the Administrator role have this capability. This means that menu data is not publically exposed via the REST API. Ticketticket Created for both bug reports and feature development on the bug tracker. #54304 provides a means for developers to opt-in to exposing this data publicly. The REST API team hopes to implement this feature in a near future release of WordPress.

These endpoints were first developed as a feature pluginFeature Plugin A plugin that was created with the intention of eventually being proposed for inclusion in WordPress Core. See Features as Plugins. on GitHub. For those using this 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, after upgrading to WordPress 5.9, the plugin can be deactivated and removed as all of it’s functionality is now included in WordPress CoreCore Core is the set of software required to run WordPress. The Core Development Team builds WordPress..

Props to @timothyblynjacobs for peer review.

#5-9, #dev-notes, #rest-api

WordPress 5.9 Release Day Process

Updated: 24 Jan 2022

Preparation for WordPress 5.9 final release is underway. This post shares the release process, including the timeline and how you can help.

Release Timeline

The current plan is:

Dry Run

Update: The Dry Run was successfully completed ✅ See the process in the #core Slack channel.

The Dry Run is a key event to determine readiness for the final release. As noted above, the current plan is to start it on 2022-01-24 15:00. You are invited to observe and/or participate. It’ll happen in the #core Slack channel.

What happens during the dry run?

  • Review bugbug A 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. reports to determine if any are critical to warrant another RCrelease 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). (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).).
  • Checks and updates are done in the src/wp-admin/includes/update-core.php file.
  • Pre-release scripts are run to ensure test suites, coding standards, and checks pass.

If the results are acceptable, the release goes into a 24-hour code freeze period.

24 Hour Code Freeze

Update: The 24-hour code freeze is in effect 🕜

After the dry run and before the release party starts, a 24-hour code freeze goes into effect.

What does this mean? No source code for 5.9.0 (i.e., in the 5.9 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".) can be changed during these 24 hours.

What happens if a critical bug is reported during this period? The release squad will meet with committers and maintainers to determine if the issue is a blockerblocker A bug which is so severe that it blocks a release..

  • If yes, another RC release happens, and the release process restarts (meaning the dry run is repeated and then the 24-hour code freeze clock restarts).
  • If no, then the bug is targeted for 5.9.1.

The Release Party 🎉

WooHoo, you’ve made it to release day 🎉!

As noted above, the current plan is to start the release party on 2022-01-25 19:20. You are invited to observe and/or participate. It’ll happen in the #core Slack channel.

The release party walks through the steps in the Major Version Release process for anyone who wants to follow along.

Please note releasing a major version requires more time than releasing a 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. or release candidate. There are more steps in the process. If there are any last-minute issues that need addressing, more time will be needed.

How You Can Help

A key part of the release process is checking that the ZIP packages work on all the different server configurations available. If you have some of the less commonly used servers available for testing (IIS, in particular), that would be super helpful. Servers running older versions of PHPPHP The web scripting language in which WordPress is primarily architected. WordPress requires PHP 5.6.20 or higher and MySQLMySQL MySQL is a relational database management system. A database is a structured collection of data where content, configuration and other options are stored. https://www.mysql.com/. will also need testing.

You can even start this early, by running the WordPress 5.9 RC3 packages, which are built using the same method as the final packages.

During the release party, options will be provided on how to help test the release package.

Tips on What to Test

In particular, testing the following types of installs and updates would be much appreciated:

  • Does a new WordPress install work correctly? This includes running through the manual install process, as well as WP-CLIWP-CLI WP-CLI is the Command Line Interface for WordPress, used to do administrative and development tasks in a programmatic way. The project page is http://wp-cli.org/ https://make.wordpress.org/cli/ or one-click installers.
  • Test upgrading from 4.0.33, 4.9.18, 5.7.2, 5.8.3, and 5.9 RC 3, as well as any other versions possible.
  • Remove wp-config.php file and test a fresh install.
  • Test single site and 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/networknetwork (versus site, blog) (both subdirectory and subdomain) installs.
  • Does it upgrade correctly? Are the files listed in $_old_files removed when you upgrade?
  • Does multisite upgrade properly?

Testing the following user flows, on both desktop and mobile, would be great to validate each function as expected:

  • Publish a post, including a variety of different blocks.
  • Comment on the post.
  • Install a new pluginPlugin A plugin is a piece of software containing a group of functions that can be added to a WordPress website. They can extend functionality or add new features to your WordPress websites. WordPress plugins are written in the PHP programming language and integrate seamlessly with WordPress. These can be free in the WordPress.org Plugin Directory https://wordpress.org/plugins/ or can be cost-based plugin from a third-party/theme, or upgrade an existing one.
  • Change the site language.
  • If you’re a plugin developer, or if there are complex plugins you depend upon, test that they’re working correctly.

Props to @jeffpaul for peer review and @marybaum, @webcommsat, and @cbringmann for editing.

#5-9, #release-process

Dev Chat Summary – January 19, 2022

Link to the start of the meeting in the WordPress Core Slack

Agenda

CoreCore Core is the set of software required to run WordPress. The Core Development Team builds WordPress. Team RepTeam Rep A Team Rep is a person who represents the Make WordPress team to the rest of the project, make sure issues are raised and addressed as needed, and coordinates cross-team efforts. @marybaum and @webcommsat led the meeting.

Announcements

WordPress 5.9 Release Candidate 3 is available.

Two key resources:
Help test WordPress 5.9 features
Read the 5.9 Field Guide.

Blogblog (versus network, site) posts of note

Update on the release

@hellofromtonya

5.9 final will land next week on 25 Jan 2022. RC3 yesterday was the last planned release before the final. If blockers or regressions are reported before 5.9 starts its 24 hour code freeze (which starts on 24 Jan), then another RCrelease 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). may happen. As of right now, there are not any reports that warrant another RC. But will keep on on it. 

@jeffpaul: You’re almost there @hellofromtonya, we’re all in support of you and the team, thanks again for everyone’s amazing work!

Release Process summary from @hellofromtonya

  • The release squad is discussing the start time for the release party on the 25th. Stay tuned.
  • The code freeze will start exactly 24 hours before that time.
  • Dry run will be on the 24th and end before that code freeze starts.
  • A post on Make Core will appear in advance to outline the release processes and how you can help.

Thank you to all contributors who made this happen! 

How can you help?

  • Test
  • Triagetriage The act of evaluating and sorting bug reports, in order to decide priority, severity, and other factors. any reports that come into TracTrac An open source project by Edgewall Software that serves as a bug tracker and project management tool for WordPress. or 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/ to help teams figure out if a report needs immediate attention. Then come join the 5.9 Release Party to help prep and test the package and get it out into the world! Celebrate.
  • @webcommsat: please share the posts about the release and the RC3 post.

5.9.1 early discussions

@jeffpaul: wait until we see how the forum responses come in post 5.9 since it sounds like nothing needing another RC as of now.

@marybaum shared she and @estelaris would be helping with the release-coordination for the minors, in in the interregnum before 6.0.

@hellofromtonya: I agree with @jeffpaul and points @desroj raised in the release leads channel. Though there are fixes ready for 5.9.1, good to give a week or so for reports to come in within the forums, Gutenberg GitHubGitHub GitHub 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/, and Trac. Why? There may be things hadn’t yet surfaced that need priority attention.

@costdev: For reporting issues when testing RC, reproducing reported issues during/triage, and for when reports land in the forums and make their way to Trac, a test report template is available to help narrow down the steps and environments where issues may occur.

Open Floor

a) Request for core agenda to be published 24 hours ahead of a meeting to allow items and links o be more easily added for the discussion. It has not been published this far in advance in the last two weeks. Confirmed.

b) FSE
@annezazu: Join me for a hallway hangout on Thursday 20 January 2022 at 9:00pm UTC to talk about 5.9. It will be held in #fse-outreach-experiment and is meant to be a casual place to chat with other folks in the WordPress space. Bring your questions, pop in and out, etc. It will be recorded and recapped. Previous editions

c) Ticketticket Created for both bug reports and feature development on the bug tracker. #54859: New Welcome’s panel “Edit styles” link does not seem to work

@audrasjb: relating to 5.9: should we consider #54859 as a blockerblocker A bug which is so severe that it blocks a release.? any thought about this small (but annoying) issue? Can probably be skipped to a minor unless there is a RC4.

@hellofromtonya: That issue needs testing and more discussion to determine what should happen and if reproducible. But does not seem to be a blocker for the 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..

If it’s merely a bad link, that’s one thing and easily fixable. If it’s something else, then discussion needs to happen about resolution.

@audrasjb: The expected behavior would be to open the Global Styles panel.

For now, the two links in the welcome panel both lead to the same screen (*), which is, indeed, annoying.
(* on 5.9 + TT2)

ironprogrammer: The first time you open Styles, it has the nifty tutorial, so it’s a shame to miss that when you come here the first time…

@hellofromtonya: The question is: What should the link be to open the panel (this would be fixable in Core)? Or is the panel not wired to a link (this would be a Gutenberg issue)?

@audrasjb: I don’t think it’s a blocker. But I think it’s annoying and it’s not a super user experience when associated to the Welcome panel which is supposed to show all the amazing stuff we shipped in this release. What I try to say is that it’s more a “communication issue” than a technical one. @jeffpaul agreed not a blocker.

@hellofromtonya:

  • let’s get it fixed.
  • Then if there are other issues that pop, it can be bundled into a RC4.
  • I agree it has to be fixed upstream in Gutenberg and then packages released and backported to Core.

@hellofromtonya: Depends upon if the URLURL A specific web address of a website or web page on the Internet, such as a website’s URL www.wordpress.org is correct or not. If not correct, then it can be fixed in Core. Else, yes, I agree it has to be fixed upstream in Gutenberg and then packages released and backported to Core.

@audrasjb: I’m currently opening an issue upstream, and also, I’m searching for any Gutenberg behavior that would open the panel based on the URL hash.

@audrasjb: If so, we could fix this on Core side.

@desrosj: I think we should be worried about making the right decisions for our users and not to avoid publications writing unfavorable pieces about us.

@marybaum: A thing that seems like not-a-blocker to us can affect UXUX User experience profoundly, which in turn can damage perception.

@hellofromtonya: For now, it’s prioritized and in the 5.9 milestone. I’ll take ownership of this issue with priority to fix it. Once fixed, then a decision can be made as to whether to do another RC or release it in.

@hellofromtonya: There are known bugs that do impact UX that are in 5.9.1. Yes, the release seeks to ship a solid experience. And yes, it would be great to have a perfect UX across the board. In this case, the link does take the user to the Site Editor where the Styles can be opened with another click. The experience is not broken nor perfect. But I don’t see it as a major blocker to the final release. But let’s see if it can be fixed quickly and if other issues come in to warrant another RC. 

@audrasjb pinged the editor team
An issue has been reported that is a good to get fixed in case there’s a 5.9 RC4.
Clicking wp-admin/site-editor.php?styles=open in the Welcome panel is expected to automatically open the Styles panel in the Site Editor.  It is not. Is this the right link? Or is this a bugbug A 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. that needs to be fixed? https://github.com/WordPress/gutenberg/issues/38090
https://core.trac.wordpress.org/ticket/54859Posted in core-editor 

d) 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, and a description of how developers are supposed to work with that change. Dev notes are published on Make/Core blog during the beta phase of WordPress release cycle. Publishing dev notes is particularly important when plugin/theme authors and WordPress developers need to be aware of those changes.In general, all dev notes are compiled into a Field Guide at the beginning of the release candidate phase.

@webcommsat and @courane01: For the work on Learn WordPress and social media, are there more dev notes on the release to come? Working on social media for LearnWP.
@marybaum: it looks like one more – https://github.com/orgs/WordPress/projects/11/views/8

Props: Meeting notes summary by: @webcommsat and light editing by @marybaum

#5-9, #dev-chat, #summary

Dev Chat agenda for January 19, 2022

The weekly developers chat meeting is at 20:00 UTC in the #core channel on Slack. Please join the group!

Announcements

WordPress 5.9 Release Candidate 3 has landed.  Please download and test! Also, please feel free to share the package and invite your friends to test 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). for themselves.

Help test WordPress 5.9 features

Read the 5.9 Field Guide.

Blogblog (versus network, site) posts of note

A year in core (December 29, 2021)

What’s new in Gutenberg 12.3 release (5 January 2022)

A Week in Core: January 17, 2022

The revised 5.9 release schedule.

Join the discussion on 2022 release planning (December 27, 2021 post by @chanthaboune)

Proposed changes to javascript coding standards for full prettier compatibility [added during devchat]

Do you have other posts that should get attention? Please add them in the comments.

Upcoming releases

@hellofromtonya will update the group on the 5.9 release. It’s due in six days, on January 25, 2022.

Component Maintainers

From now until 5.9 launch, devchat will skip a formal check-in so the group can have a longer Open Floor. If you’re a maintainer who would like to get help with a blockerblocker A bug which is so severe that it blocks a release. or share success/ collaboration, please feel free to either comment on this post or in the meeting.

Open Floor

Please add your topic to the comments below.

#agenda#core#dev-chat#week-in-core

#5-9, #agenda, #dev-chat

#core

A Week in Core – January 17, 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 January 10 and January 17, 2022.

  • 34 commits
  • 39 contributors
  • 74 tickets created
  • 20 tickets reopened
  • 53 tickets closed

The Core team is currently working on the next major release, WordPress 5.9 🛠

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

  • Ensure an integer is used for menu priority in add_menu_page()#54798, #48249
  • Fix an erroneous translators comment after changeset [52569]#54798
  • Replace “Current theme” with “Active theme” in user facing strings – #54770
  • Revert [51946]#54837, #53587
  • Update design of the Dashboard welcome panel – #54489

Build/Test Tools

  • Re-enable E2E tests for the 5.8 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".#54749
  • Avoid duplicate queries in some WP_Query tests – #54822
  • Trac ticket number correction after changeset [52569]#54798

Bundled Themes

  • Twenty Twenty-Two: Sync updates from GitHubGitHub GitHub 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/ for RCrelease 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). 2
  • Twenty Twenty-Two: Sync updates from GitHub from RC3 – #54318

Coding Standards

  • Correct alignment in get_block_editor_settings()#54728
  • Remove an extra variable in get_author_posts_url()#54728
  • Rename the $val variable to $site for clarity in WP_MS_Users_List_Table::column_blogs()#54728
  • Use strict comparison in wp-admin/includes/class-wp-ms-users-list-table.php#54728
  • Use strict comparison in wp-admin/includes/class-wp-users-list-table.php#54728

Database

  • Add missing AS after INNER JOIN in some queries – #54769

Docs

  • Correct description for two HTTPHTTP HTTP is an acronym for Hyper Text Transfer Protocol. HTTP is the underlying protocol used by the World Wide Web and this protocol defines how messages are formatted and transmitted, and what actions Web servers and browsers should take in response to various commands. 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. functions: – #54796
  • Miscellaneous docblockdocblock (phpdoc, xref, inline docs) corrections in 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/. and Sitemaps API – #54729
  • Typo correction in WP_REST_Response class docblocks – #54823

Editor

  • Explicitly load remote 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. patterns in the block and site editor screens – #54806
  • Fix enqueueing additional styles in wp_enqueue_block_style() to print only when blocks render – #54787
  • Update some default presets in use by default themes to the new format – #54782
  • WordPress default presets aren’t loaded for all themes – #54781
  • Site Editor: Fix typo in home template translatable description – #54787
  • Update packages to include these bugbug A 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. fixes from 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/: – #54487

Help/About

  • Correction in “Managing Themes” HelpHub Docs link – #54707
  • Update the About section for 5.9 – #54270

Internationalization

  • Contextualize “light” color translationtranslation The process (or result) of changing text, words, and display formatting to support another language. Also see localization, internationalization. strings – #54804

Media

  • Add a missing / in post thumbnail lazy loading regex – #54815
  • Typo correction in wp_image_maybe_exif_rotate docblock – #54816

Script Loader

  • Fix a variable typo in wp_enqueue_block_style#54786

Upgrade/Install

  • Check if the disk_free_space() function exists before calling it – #54826, #54730
  • Typo correction in a Core_Upgrader class inline comment – #54821

XML-RPC

  • Fix typos in some XMLRPC related docblocks – #54820

Props

Thanks to the 39 people who contributed to WordPress Core on Trac last week: @audrasjb (8), @costdev (5), @kebbet (4), @SergeyBiryukov (4), @hellofromTonya (3), @richtabor (2), @Presskopp (2), @critterverse (2), @poena (2), @kjellr (2), @oandregal (2), @joedolson (2), @danieldudzic (1), @omaeyusuke (1), @sabernhardt (1), @aristath (1), @Mamaduka (1), @domainsupport (1), @scruffian (1), @kharisblank (1), @talldanwp (1), @isabel_brison (1), @desrosj (1), @versusbassz (1), @SierraTR (1), @kirtan95 (1), @johnbillion (1), @chesio (1), @mitogh (1), @noisysocks (1), @shreyasikhar26 (1), @david.binda (1), @swb1192 (1), @jrf (1), @tobifjellner (1), @ironprogrammer (1), @dhusakovic (1), @peterwilsoncc (1), and @jdy68 (1).

Congrats and welcome to our 9 new contributors of the week: @omaeyusuke, @domainsupport, @versusbassz, @SierraTR, @kirtan95, @shreyasikhar26, @swb1192, @ironprogrammer, @dhusakovic ♥️

Core committers: @audrasjb (12), @sergeybiryukov (9), @hellofromtonya (4), @jffng (2), @ryelle (2), @davidbaumwald (2), @jorgefilipecosta (2), and @noisysocks (1).

#5-9, #core, #week-in-core

Dev Chat agenda for January 12, 2021

The weekly developers chat meeting is at 20:00 UTC in the #core channel on Slack. Please join the group!

Announcements

WordPress 5.9 Release Candidate 2 has landed.  Please download and test! Also, please feel free to share the package and invite your friends to test 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). for themselves.

Help test WordPress 5.9 features

Read the latest Developer Notes

3. Blogblog (versus network, site) posts to note

A year in core (December 29, 2021)

What’s new in Gutenberg 12.2 release (5 January 2022)

A Week in CoreCore Core is the set of software required to run WordPress. The Core Development Team builds WordPress.: January 10, 2022

The revised 5.9 release schedule.

Join the discussion on 2022 release planning (December 27, 2021 post by @chanthaboune)

Proposal: Approving custom block pattern directory submissions (posted January 4, feedback by January 14, 2022)

Proposed changes to javascript coding standards for full prettier compatibility [added during devchat]

Do you have other posts that should get attention? Please add them in the comments.

4. Upcoming releases

@hellofromtonya will update the group on the 5.9 release, slated for January 25, 2022.

Component Maintainers

From now until 5.9 launch, devchat will skip a formal check-in so the group can have a longer Open Floor. If you’re a maintainer who would like to get help with a blockerblocker A bug which is so severe that it blocks a release. or share success/ collaboration, please feel free to either comment on this post or in the meeting.

Open Floor

Please add your topic to the comments below.

#agenda#core#dev-chat#week-in-core

#5-9, #agenda, #dev-chat

A Week in Core – January 10, 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 January 3 and January 10, 2022.

  • 41 commits
  • 63 contributors
  • 65 tickets created
  • 8 tickets reopened
  • 51 tickets closed

The Core team is currently working on the next major release, WordPress 5.9 🛠

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

  • Add missing texture image for Welcome panel & About page – #54489, #54270
  • Refresh the Dashboard Welcome panel – #54489

Build/Test Tools

  • Add the 5.9 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". to the workflow for testing branches
  • Re-enable E2E tests for the 5.8 branch – #54749
  • Update qUnit test fixtures after [52535]#54745

Bundled Themes

  • Fix: WordPress default presets aren’t loaded for all themes – #54781
  • Update some default presets in use by default themes to the new format – #54782
  • Twenty Twenty-Two: Sync updates from GitHubGitHub GitHub 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/ for RCrelease 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). 1 – #54318

Coding Standards

  • Remove empty space at end of inline comment in _add_default_theme_supports()#54731
  • Correct alignment in get_block_editor_settings()#54728
  • Use strict comparison in wp-admin/options.php#53359
  • Use strict comparison in wp-admin/plugin-install.php#54728
  • Use strict comparison in wp-admin/revision.php#54728
  • Use strict comparison in wp-admin/themes.php#54728

Editor

  • Update wordpress packages for WP 5.9 RC 1 – #54487

Embeds

  • Fix oEmbed host script enqueueing on 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.-based themes – #44632

External Libraries

  • Update jQuery hoverIntent to version 1.10.2 – #54722, #51812

Formatting

  • Correctly encode ASCII characters in post slugs

HTTPHTTP HTTP is an acronym for Hyper Text Transfer Protocol. HTTP is the underlying protocol used by the World Wide Web and this protocol defines how messages are formatted and transmitted, and what actions Web servers and browsers should take in response to various commands. 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.

  • Improve docs for wp_remote_retrieve_header function return value – #51736

Help/About

  • Change the HTMLHTML HyperText Markup Language. The semantic scripting language primarily used for outputting content in web browsers. title of Themes Screen and add related HelpHub Docs link – #54707
  • Change the Learn WP link in the about page – #54755
  • Correction in “Managing Themes” HelpHub Docs link – #54707
  • Correction on the documentation link about adding new themes – #54709
  • Use “refactoring” noun form in WordPress 5.9 About Page – #54270
  • WordPress 5.9 About Page

Login and Registration

  • Remove aria-expanded from “Generate Password” button – #54538
  • Rename login_language_switcher_args to login_language_dropdown_args#54696
  • Rename two filters related to language dropdown for better consistency – #54696

Query

  • Improve sanitization within WP_Meta_Query
  • Improve sanitization within WP_Tax_Query

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

  • Add unit tests for the 404 template slug handler – #54680
  • Typo correction in a link description object – #54745

RevisionsRevisions The WordPress revisions system stores a record of each saved draft or published update. The revision system allows you to see what changes were made in each revision by dragging a slider (or using the Next/Previous buttons). The display indicates what has changed in each revision.

  • Improve _set_preview for case when autosave is missing – #54708

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.

  • Typo correction in context used for the navigation link block title – #54566

Themes

  • Make block themes support HTML5 by default – #54731, #54597

Upgrade/Install

  • Avoid using unserialize() unnecessarily
  • Fix parameter count in error call when an automatic core upgrade fails – #53284
  • Make first comment URLs translatable – #54535

Props

Thanks to the 63 people who contributed to WordPress Core on Trac last week: @hellofromTonya (9), @audrasjb (7), @desrosj (5), @SergeyBiryukov (4), @costdev (4), @xknown (4), @tobifjellner (3), @jdy68 (3), @dd32 (3), @marybaum (3), @sabernhardt (2), @oandregal (2), @critterverse (2), @kebbet (2), @melchoyce (2), @walbo (2), @webcommsat (2), @Mamaduka (2), @johnjamesjacoby (2), @davidbaumwald (2), @peterwilsoncc (2), @vortfu (2), @chanthaboune (1), @mukesh27 (1), @mkaz (1), @kjellr (1), @ryelle (1), @annezazu (1), @paaljoachim (1), @richtabor (1), @Clorith (1), @mitogh (1), @adamsilverstein (1), @kafleg (1), @faisal03 (1), @swissspidy (1), @westonruter (1), @rachelbaker (1), @ockham (1), @flixos90 (1), @cbringmann (1), @smit08 (1), @nalininonstopnewsuk (1), @hlashbrooke (1), @sainthkh (1), @devutpol (1), @Chouby (1), @la-geek (1), @zieladam (1), @whyisjake (1), @iandunn (1), @ehtis (1), @alexstine (1), @dansoschin (1), @jameskoster (1), @noisysocks (1), @karmatosed (1), @poena (1), @robtarr (1), @felipeelia (1), @joyously (1), @ocean90 (1), and @titsmaker (1).

Congrats and welcome to our new contributor of the week: @dansoschin, @robtarr ♥️

Core committers: @audrasjb (13), @sergeybiryukov (9), @hellofromtonya (5), @davidbaumwald (4), @desrosj (4), @ryelle (3), @jorgefilipecosta (2), and @noisysocks (1).

#5-9, #core, #week-in-core

WordPress 5.9 Field Guide

WordPress 5.9 unlocks the ability to build with blocks across all parts of your site, bringing advanced design tools to build your templates, themes, and style your sites in new and exciting ways.

Let’s take a look at what to expect in WordPress 5.9.

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

WordPress 5.9 might be the largest release of 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/ features since the initial Gutenberg launch in WordPress 5.0. The latest version includes a full suite of site editing tools bringing the block editor to the full screen. This includes a new way to build themes, new ways to create templates, and style your site. Plus a dozen new theme blocks to load dynamic content.

All of this is shown off in the beautiful new Twenty Twenty-Two default theme.

Review the block theme dev notedev note Each important change in WordPress Core is documented in a developers note, (usually called dev note). Good dev notes generally include a description of the change, the decision that led to this change, and a description of how developers are supposed to work with that change. Dev notes are published on Make/Core blog during the beta phase of WordPress release cycle. Publishing dev notes is particularly important when plugin/theme authors and WordPress developers need to be aware of those changes.In general, all dev notes are compiled into a Field Guide at the beginning of the release candidate phase. for more information around block themes and how to get started building your own.

WordPress 5.9 incorporates all of the changes to the Gutenberg plugin since the last release until the code freeze which was Gutenberg 11.9; to see in detail all that these entail see the “What’s New” post for the releases: 10.8, 10.9, 11.0, 11.1, 11.2, 11.3, 11.4, 11.5, 11.6, 11.7, 11.8, 11.9

Here are the 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, and a description of how developers are supposed to work with that change. Dev notes are published on Make/Core blog during the beta phase of WordPress release cycle. Publishing dev notes is particularly important when plugin/theme authors and WordPress developers need to be aware of those changes.In general, all dev notes are compiled into a Field Guide at the beginning of the release candidate phase. related to block editor updates:

Performance

CoreCore Core is the set of software required to run WordPress. The Core Development Team builds WordPress. 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.

Internationalization

Themes & CustomizerCustomizer Tool built into WordPress core that hooks into most modern themes. You can use it to preview and modify many of your site’s appearance settings.

PHPPHP The web scripting language in which WordPress is primarily architected. WordPress requires PHP 5.6.20 or higher 8.0 and 8.1

Tooling

Other Developer Updates

But wait, there’s more!

5.9 offers so much more! Over 100 bugs, 99 enhancements, 5 feature requests, and 51 blessed tasks have been marked as fixed in WordPress 5.9.

Here are a few additional:

  • Switch to block theme from customizer (Trac 54549)

#5-9, #field-guide

WordPress 5.9 and PHP 8.0-8.1

PHPPHP The web scripting language in which WordPress is primarily architected. WordPress requires PHP 5.6.20 or higher 8.1 was released on 25 November 2021. PHP 8.1 contains new features, performance improvements, deprecations, and backward compatibility breaks. For more information, see the PHP 8.1 release page, changelog, and migration guide.

WordPress is not fully compatible with PHP 8.0 or 8.1. All remaining known PHP 8.1 issues are deprecation notices.

Please note, a deprecation notice is not an error, but rather an indicator of where additional work is needed for compatibility before PHP 9 (i.e. when the notices become fatal errors). With a deprecation notice, the PHP code will continue to work and nothing is broken.

The following is a breakdown of changes in WordPress CoreCore Core is the set of software required to run WordPress. The Core Development Team builds WordPress. that 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 theme developers need to be aware of and accommodate in their code.

PHP 8.1 Remaining known deprecation notices

Deprecation notices remain in WordPress 5.9 and work will continue in the 6.0 cycle.

What is required to resolve each?

  • Resolution requires a more structural and all-encompassing solution for input validation (i.e. validating the data type and, in some cases, value passed to a function/method) to be architected and implemented to properly fix the underlying bugbug A 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. rather than introducing buggy unexpected behavior by haphazardly silencing the deprecation notice.
  • Each notice needs investigation to determine the impact of such changes.
  • Each change requires thorough testing including full coverage happy and unhappy unit/integration tests.

The remaining known deprecation notices include:

  • Functions in the wp-includes/formatting.php file.
  • parse_url() or wp_parse_url() passed directly to a non-nullable in PHP native function without validating a string type is returned (i.e. both will return null when the requested component doesn’t exist within the given URLURL A specific web address of a website or web page on the Internet, such as a website’s URL www.wordpress.org (see the PHP manual)).
  • wp_xmlrpc_server::mw_newPost(): changing content structure default values from null to an empty string. This change requires a review from XMLRPC domain expert and more testing.
  • Upgrade to Requests 2.0.0: Originally planned for WordPress 5.9, but reverted due to issues with WordPress Core’s updater. Currently planned for 6.0 (TracTrac An open source project by Edgewall Software that serves as a bug tracker and project management tool for WordPress. #54504).

To follow or contribute to this ongoing work, see Trac #53465, #53635, #54183, and #54730.

WordPress Core Changes

PHP 8.0 polyfills introduced

The following PHP 8 polyfills are available in WordPress 5.9:

Each polyfill loads into memory when the site is run on PHP versions less than PHP 8.0.

PHP 8.0 named parameters: match parent to child class method signatures

As noted last year in the PHP 8.0 dev note, WordPress Core is not compatible nor supports named parameters:

Using named parameters when calling WordPress functions and class methods is explicitly not supported and highly discouraged until this audit can be completed, as during the audit, parameter names are subject to change without notice. When this audit has been completed, it will be announced in a future developer note.

In 5.9, WordPress Core’s parent and child class method signatures were changed. The parameter names match in the parent and child methods.

If you extend Core classes and choose to support named parameters, you’ll need to audit and change each method being overloaded to ensure the method signatures match the Core class being extended.

To follow or contribute to this review, see Trac #51553, and #50531.

PHP 8.1 readonly() renamed to wp_readonly()

Though originally planned as a reserved keyword, PHP 8.1 changed readonly keyword to a (limited) contextual keyword with potential future plans to deprecate.

WordPress 5.9 renames the readonly() function to wp_readonly(). For PHP 8.0 or earlier, the original readonly() function is loaded into memory but deprecated.

Reference:

PHP 8.1 return type enforcement and new #[ReturnTypeWillChange] attribute

PHP 8.1 introduces a new #[ReturnTypeWillChange] attribute to silence the deprecation notice for each PHP native interface method where the overloaded method’s return type is incompatible. WordPress Core adds the attribute to each of its instances.

When overloading a PHP native interface method, you should either have the return type declared (in a covariant compatible manner with the PHP native interface method declaration), or add the #[ReturnTypeWillChange] attribute to silence the deprecation notice.

For example, when implementing the ArrayAccess interface, ensure the required methods are compatible or add the attribute as follows:

/**
 * @param mixed $offset The offset to check for.
 *
 * @return bool True on success or false on failure.
 */
#[ReturnTypeWillChange]
public function offsetExists( $offset ) {
	// the code
}

/**
 * @param mixed $offset The offset to retrieve.
 *
 * @return mixed The offset’s value.
 */
#[ReturnTypeWillChange]
public function offsetGet( $offset ) {
	// the code
}

/**
 * @param mixed $offset The offset to assign the value to.
 * @param mixed $value  The value to set.
 */
#[ReturnTypeWillChange]
public function offsetSet( $offset, $value ) {
	// the code
}

/**
 * @param mixed $offset The offset to unset.
 */
#[ReturnTypeWillChange]
public function offsetUnset( $offset ) {
	// the code
}

See the PHP RFC: Add return type declarations for internal methods.

PHP 8.1 MySQLi default error mode changed

PHP 8.1 changed the default mysqli error mode from silent to fatal error.

Prior to PHP 8.1, the default error handling mode of MySQLi was silent (i.e. MYSQLI_REPORT_OFF). An error in the extension, database, query, or the database connection returned false and emitted a PHP warning.

PHP 8.1 changed the default error mode to MYSQLI_REPORT_ERROR|MYSQLI_REPORT_STRICT. An error in the extension, database, query, or the database connection throws a fatal error exception.

WordPress Core has its own error reporting and gracefully handles the database errors by inspecting the error codes. In 5.9, Core sets MySQLi error reporting to off to avoid fatal errors due to uncaught exceptions and maintains the current behavior (see Trac #52825).

If you are using wpdb, 5.9 takes care of this for you. However, if you are not using wpdb, you will need to make changes in your theme or plugins. It is recommended to switch to wpdb.

References:

PHP 8.1 deprecation: passing null to non-nullable PHP native functions parameters

A deprecation notice is thrown when passing a null value to a PHP native function’s parameter that is not declared nullable. The value will continue to be coerced, meaning the PHP behavior has not (yet) changed. However, in PHP 9, a TypeError will be thrown.

For example, passing null to strlen() (which expects a string type) will throw the following notice:

Deprecated: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in .. on line ..

The deprecation notice identifies where an underlying bug exists in the code base. Rather than merely silencing the deprecation, the approach taken in WordPress Core is to fix each underlying bug notice through input validation (i.e. validating what is passed to the function) or targeted guarding to skip processing for type mismatches.

As noted previously, deprecation notices remain in WordPress Core. These remaining deprecation notices will require a more structural and all-encompassing architectural solution and tests to avoid haphazardly silencing the deprecation notice while potentially introducing buggy, unexpected behavior.

To follow or contribute to this effort, see Trac #54730.

What do you need to do?

Analyze each deprecation notice in your theme or plugin and craft a solution that resolves the bug.

For example, skip the trim() operation when the value to trimmed is not scalar:

if ( is_scalar( $value ) ) {
	$value = trim( $value );
}

Check that a string type is returned from the following function before passing the returned value to a PHP native function:

  • parse_url() or wp_parse_url() will return null when the requested component doesn’t exist within the given URL (see the PHP manual).
  • filter_input() will return null if the var_name to get is not set or if using FILTER_NULL_ON_FAILURE flag but the 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. fails.

For example:

$url_path     = parse_url( $url, PHP_URL_PATH );
$url_filename = '';
if ( is_string( $url_path ) && '' !== $url_path ) {
	$url_filename = basename( $url_path );
}

References:

PHP 8.1 deprecation: autovivification on false

Autovivification is the automatic creation of an array. When a variable is defined as a boolean false and then used as an array as shown,

$arr   = false;
$arr[] = 2;

PHP 8.1 throws a deprecation notice:

Deprecated: Automatic conversion of false to array is deprecated in .. on line ..

In PHP 8.1, this code will continue to work; however, in PHP 9.0, it will result in a fatal error.

There are multiple ways to fix your code to not only resolve the deprecation notice but to also avoid a fatal error in the future when PHP 9 is released. Some of ways include:

  • Declare an array before using it, i.e. $arr = array();.
  • Check the returned value to ensure it is an array or at minimum not false before using.
  • When getting an option with get_option(), if an array type is expected, set the default to an empty array.
$options = get_option( ‘some_option’, array() );

For more information, see the PHP RFC: Deprecate autovivification on false.

PHP 8.1 deprecation: implicit incompatible float to int conversion

The implicit conversion of float to int which leads to precision loss will throw a deprecation notice.

$arr = array();
$arr[15.5]; // will throw the deprecation notice because 0.5 is lost

References:

PHP 8.1 other notable deprecations and changes

The following functions are deprecated:

  • Date functions: date_sunrise(), date_sunset(), gmstrftime(), strftime(), strptime().
  • Hash functions:  mhash(), mhash_keygen_s2k(), mhash_count(), mhash_get_block_size(), and mhash_get_hash_name() .
  • Calling key(), current(), next(), prev(), reset(), or end() on objects is deprecated.

The following functions changed:

  • The default of ENT_COMPAT changed to ENT_QUOTES | ENT_SUBSTITUTE in these functions htmlspecialchars(), htmlentities(), htmlspecialchars_decode(), html_entity_decode(), and get_html_translation_table() (Trac #53465).
  • Undocumented operation abbreviations can no longer be passed to version_compare().

See the Migrating from PHP 8.0.x to PHP 8.1.x for a complete list of deprecations and changes.

External Libraries

WordPress 5.9 includes the following updated external libraries:

  • GetID3 1.9.21 which includes preliminary PHP 8.1 support (Trac #54162).
  • SimplePie 1.5.7 which includes significant PHP 8.0 and 8.1 compatibility improvements ( Trac #54659).
  • PHPMailer 6.5.1 which includes preliminary PHP 8.1 support (Trac #53953).

The Requests 2.0.0 library was originally planned for WordPress 5.9. However, due to issues with WordPress Core’s upgrader, it was reverted and planned for 6.0 (Trac #54504).

Test Suites and Tooling

Changes to the WordPress Core PHP Test Suite

What about static tooling? Can it identify incompatibilities?

PHPCompatibility can only find a limited amount of these issues. PHPStan/Psalm/Exakat may find more, but are prone to false positives for non-typed code bases.

A Good Test Suite is the first line of defense

Most of the incompatibilities can be found through a good test suite, which includes full test coverage of both happy and unhappy paths.

Theme and plugin developers are encouraged to extend your test suites.

WordPress Core’s test coverage is currently less than 10%. You are invited and encouraged to contribute tests to grow test coverage in WordPress.

PHPUnit deprecation notices

In PHPUnit < 9.5.10/8.5.21, if a PHP native deprecation notice was encountered, PHPUnit would:

  1. Show a test which causes a deprecation notice to be thrown as “errored”;
  2. Show the first deprecation notice it encountered;
  3. Exit with a non-0 exit code (2), which will fail a CI build.

As of PHPUnit 9.5.10/8.5.21, if a PHP native deprecation notice is encountered, PHPUnit will:

  1. Show a test which causes a PHP deprecation notice to be thrown as “risky”;
  2. Show all deprecation notices it encountered;
  3. Exit with a 0 exit code, which will pass a CI build.

To follow or contribute to this review, see Trac #54183.

Why is this a problem?

These deprecations will become errors in the next PHP major and they will still need to be fixed. As CI builds pass, the deprecations go unnoticed. This means more deprecations remaining in WordPress Core, and would lead to more reports of deprecation notices from end-users.

What’s changing in WordPress Core?

The single site and 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 PHPUnit configuration files for WordPress Core now include the following attributes:

convertErrorsToExceptions="true"
convertWarningsToExceptions="true"
convertNoticesToExceptions="true"
convertDeprecationsToExceptions="true"

How does this solve the problem?

This will cause CI builds to fail when a native PHP deprecation notice is encountered, meaning that deprecation notices can not go unnoticed.

Are there any negatives?

Only the first deprecation notice will be shown for a test, and there may be more issues hiding behind a deprecation.

What’s coming in PHP 8.2

A significant change is coming in PHP 8.2 which could impact your themes and plugins. The  RFC to deprecate dynamic properties was approved. See the RFC for more information.


Props to @costdev and @jrf for contributing to 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, and a description of how developers are supposed to work with that change. Dev notes are published on Make/Core blog during the beta phase of WordPress release cycle. Publishing dev notes is particularly important when plugin/theme authors and WordPress developers need to be aware of those changes.In general, all dev notes are compiled into a Field Guide at the beginning of the release candidate phase., and to @costdev, @antonvlasenko, @javiercasares, and @andraganescu for reviewing.

#5-9, #dev-notes