WordPress Release: 5.9.0

Tag Name: 5.9.0

Release Date: 1/25/2022

WordPress LogoWordPress

World's most popular open-source content management system powering over 40% of all websites. Offers extensive plugin ecosystem, themes, and robust community support for blogs, e-commerce, and corporate websites. Highly customizable and scalable platform suitable for beginners and advanced developers.

TL;DR

WordPress 5.9 "Josephine" introduces Full Site Editing, a new default theme (Twenty Twenty-Two), and significant improvements to the block editor. This major release brings the power of blocks to the entire site, allowing users to create and edit templates directly in the editor. It also includes new design tools, block pattern improvements, and numerous performance enhancements.

Highlight of the Release

    • Full Site Editing: Design your entire site with blocks, not just content
    • Twenty Twenty-Two: A beautiful new default block theme with incredible flexibility
    • Global Styles interface: Change colors, typography, and layouts across your entire site
    • Navigation block: Create and edit complex menus visually
    • Block Pattern improvements: Access to a directory of patterns and featured collections
    • Enhanced Gallery block: More flexible layouts with drag-and-drop functionality
    • Theme.json: Powerful new way to configure block themes and styles

Migration Guide

Upgrading to WordPress 5.9

  1. Before upgrading:

    • Back up your website completely (files and database)
    • Update all plugins and themes to their latest versions
    • Test compatibility in a staging environment if possible
  2. Theme Compatibility:

    • Classic themes will continue to work as before
    • Block themes require WordPress 5.9 or higher
    • If using a custom theme, check compatibility with the block editor enhancements
  3. Block Editor Changes:

    • The Gallery block has been updated with a new implementation
    • Existing Gallery blocks will continue to work but can be upgraded to the new version
    • Navigation block replaces the classic menu system in block themes
  4. Full Site Editing Considerations:

    • Full Site Editing is only available with block themes
    • Switching to a block theme will change your site editing experience significantly
    • Customizer is not available for block themes; use the Site Editor instead
  5. Developer Notes:

    • Review theme.json schema changes if you're developing block themes
    • Check the updated REST API endpoints for templates and global styles
    • Note the new template resolution algorithm for block templates
    • Update any code that interacts with the block editor API
  6. Plugin Compatibility:

    • Plugins that extend the editor may need updates for compatibility
    • Plugins that modify the Customizer may not work with block themes
    • Test all critical plugins after upgrading

Upgrade Recommendations

Recommended for: All WordPress users

WordPress 5.9 is a major release with significant improvements to the block editor and the introduction of Full Site Editing. While the changes are substantial, the core team has ensured backward compatibility for existing sites.

Timing:

  • For sites using the block editor: Upgrade at your earliest convenience
  • For sites using the classic editor: Safe to upgrade, as classic editor functionality is maintained
  • For developers: Review the changes to the block editor API and theme.json schema before upgrading

Preparation:

  1. Create a complete backup of your site
  2. Update all plugins and themes to their latest versions
  3. Test the update on a staging site if possible
  4. Review any custom code that interacts with the editor or theme system

Considerations:

  • If you're using a custom theme, it will continue to work as before
  • Full Site Editing features are only available with block themes
  • The new Twenty Twenty-Two theme requires WordPress 5.9 to function properly

This release includes important security fixes, performance improvements, and new features that benefit all WordPress users, making it a recommended upgrade for everyone.

Bug Fixes

Editor Fixes

  • Fixed issue where autosaves were deleted when a new autosave was sent with the same data
  • Resolved issue with featured image modal only showing the selected image
  • Fixed non-existent menu handling in navigation block
  • Corrected block style name validation to prevent spaces
  • Fixed issue with media preview being cut off in "Add Media" modal
  • Resolved issue with skip link positioning in block themes

Template and Theme Fixes

  • Fixed template resolution to give precedence to child theme PHP templates over parent theme block templates
  • Corrected handling of template parts in the editor
  • Fixed issue with block template resolution for new posts and pages
  • Resolved issue with theme directory names containing periods and other special characters

Performance and API Fixes

  • Fixed REST API issues with template endpoints
  • Corrected handling of taxonomy terms in feed links
  • Fixed issue with enqueueing block stylesheets
  • Improved sanitization in various query classes
  • Fixed handling of non-scalar types in sanitize_key()

Media and Formatting Fixes

  • Fixed wp_exif_frac2dec() to properly handle invalid input values
  • Improved handling of custom image alt text in custom header images
  • Fixed selections in Media Library Featured Image modal
  • Corrected oEmbed host script enqueueing on block-based themes

Accessibility Fixes

  • Added accessible labeling to submenu buttons
  • Added aria-current="page" to active navigation items
  • Fixed focus handling in navigation components
  • Improved screen reader text in various components

New Features

Full Site Editing

WordPress 5.9 introduces Full Site Editing, allowing users to edit and design their entire website using blocks. This includes:

  • Site Editor: A new interface for editing templates and template parts
  • Template Editor: Create and customize templates directly in the editor
  • Global Styles: Control site-wide design settings like colors, typography, and spacing
  • Theme Blocks: Header, footer, sidebar, and other theme elements are now available as blocks

Twenty Twenty-Two Theme

The new default theme is WordPress's first block theme, designed to take full advantage of Full Site Editing:

  • Built entirely using blocks with no traditional PHP templates
  • Highly flexible design with minimal CSS
  • Diverse color palette options
  • Beautiful patterns for quick page building
  • Responsive design that works across all devices

Navigation Block

A powerful new Navigation block allows users to:

  • Create and edit menus visually in the editor
  • Add links, pages, and other content types
  • Style navigation with colors, typography, and spacing
  • Create dropdown menus and mobile-friendly navigation

Block Pattern Improvements

  • New pattern directory integration in the editor
  • Featured pattern collections
  • Improved pattern inserter interface
  • More patterns available in Twenty Twenty-Two theme

Enhanced Gallery Block

  • Drag-and-drop functionality for reordering images
  • More flexible layout options
  • Better caption support
  • Improved mobile experience

Theme.json Configuration

A new way to configure block themes with:

  • Global style settings
  • Color palettes
  • Typography settings
  • Block-specific configurations
  • Layout controls

Security Updates

Query Sanitization

  • Improved sanitization within WP_Tax_Query to prevent potential SQL injection vulnerabilities
  • Enhanced sanitization in WP_Meta_Query for better security
  • Fixed potential security issues in post slug encoding

Input Validation

  • Added stricter validation for block style names
  • Improved handling of non-scalar types in sanitize_key()
  • Enhanced validation for template and template part slugs

KSES Improvements

  • Added callback validation to HTML tag attributes for increased flexibility
  • Improved validation of PDF objects to prevent mime type mismatches
  • Enhanced URL validation in PDF upload paths

Upgrade Process

  • Avoided using unserialize() unnecessarily to prevent potential object injection
  • Improved security in the theme and plugin installation process

Performance Improvements

Block Editor Performance

  • Improved performance of block editor initialization
  • Enhanced rendering speed for complex layouts
  • Optimized block pattern loading and rendering
  • Reduced JavaScript bundle sizes for better load times

Query Performance

  • Improved caching for template resolution
  • Enhanced performance of wp_navigation lookup
  • Optimized REST API responses for template and global styles endpoints
  • Better handling of block assets loading only when needed

Asset Loading

  • Core block assets now only load when blocks are rendered
  • Improved script and style dependency management
  • Enhanced asset caching for global styles
  • Reduced duplicate style loading for WordPress default presets

Database Optimization

  • More efficient handling of template and template part storage
  • Improved transient usage for URL details endpoint
  • Better performance for theme.json data retrieval
  • Optimized global styles data storage and retrieval

Impact Summary

WordPress 5.9 "Josephine" represents one of the most significant updates to WordPress in recent years, fundamentally changing how websites can be built and edited. The introduction of Full Site Editing transforms WordPress from a content management system to a complete site design system, where every aspect of a website can be created and modified using blocks.

For site builders and designers, this release dramatically expands creative possibilities without requiring code knowledge. The new Twenty Twenty-Two theme showcases this flexibility, offering unprecedented customization through the block editor and global styles interface. Users can now create and modify templates directly in the editor, control site-wide design settings, and build complex layouts with improved tools.

Content creators benefit from numerous enhancements to the block editor, including a more intuitive interface, improved Gallery block with drag-and-drop functionality, and better typography and color controls. The integration of the pattern directory brings a wealth of design options directly into the editor.

For developers, WordPress 5.9 introduces a more structured approach to theme development through theme.json, new REST API endpoints, and improved block APIs. This creates new opportunities for extending WordPress while also requiring adaptation to the new systems.

The performance improvements in asset loading, block rendering, and database queries make WordPress faster and more efficient, particularly for complex sites using the block editor extensively.

Overall, WordPress 5.9 represents a pivotal moment in WordPress's evolution, laying the groundwork for a more visual, flexible, and powerful content management system while maintaining compatibility with existing sites and workflows.

Statistics:

File Changed300
Line Additions10,650
Line Deletions9,145
Line Changes19,795
Total Commits250

User Affected:

  • Can now use Full Site Editing to design entire websites using blocks
  • Access to a new Site Editor for block themes
  • Can create and customize templates directly in the editor
  • Can use the new Twenty Twenty-Two block theme

Contributors:

audrasjbdesrosjSergeyBiryukovnoisysocksyouknowriadjohnbillionspacedmonkeyhellofromtonyapeterwilsonccjffngtellthemachinesryelledream-encodejorgefilipecostaocean90