Skip to content

Ensure compatibility with WP 7.0#1161

Open
gabrielcld2 wants to merge 11 commits intodevelopfrom
wp-7.0
Open

Ensure compatibility with WP 7.0#1161
gabrielcld2 wants to merge 11 commits intodevelopfrom
wp-7.0

Conversation

@gabrielcld2
Copy link
Copy Markdown
Collaborator

@gabrielcld2 gabrielcld2 commented Apr 7, 2026

Approach

  • Review and test integration with upcoming 7.0 WP release. Priority of this ticket is to ensure functionalities remain as they are once WP 7.0 is released
  • Review deprecation warnings and fix the ones that can be fixed without large refactoring
  • Upgrade WP Core minimum required version to allow using more recent functionalities

Some notable exceptions of issues that couldn't be resolved:

Gallery settings page

Screenshot 2026-04-07 at 10 43 09

The suggested replacement is still marked as experimental. It would be risky to use an experimental component that might change its API within our plugin (our linter advice against it too). Remaining on the deprecated (but still working) component seems safer.

Gallery block

Screenshot 2026-04-07 at 10 42 30

The gallery block styling is enqueued via the enqueue_block_editor_assets hook at the moment. Ideally we should migrate to using a block.json file combined with editorStyle property... however the structural changes are quite large so we might need to have a separate refactor task to upgrade the gallery block to apiVersion 3 with block.json support.

Screenshot 2026-04-07 at 10 42 15

apiVersion 3 means full iframe support within the editor. Unfortunately this doesn't work well with the current structure of this block, as it's currently loading the gallery widget for a live preview within the editor. This is sort of related to the above issue.

QA notes

  • Follow any recommended method here to install the latest WP 7.0 RC
  • Perform some overall regression testing of the plugin, particularly:
    • the gallery settings page
    • the gallery block on the editor

Copy link
Copy Markdown

@PatelUtkarsh PatelUtkarsh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR looks good!

@gabrielcld2
Copy link
Copy Markdown
Collaborator Author

gabrielcld2 commented Apr 13, 2026

Some further changes were introduced:

Compatibility with WP 5.6

There are still users on WP 5.6+ using this plugin therefore we're ensuring this version keeps being supported for now.

This required some changes:

  • remove apiVersion from gallery block
  • runtime fallback to previous deprecatedrender call if createRoot isn't available
  • reintroduce isSecondary props usage on Button component (along side the new prop). This ensures both old and new WP versions works
  • Switch JSX transform from automatic to classic runtime. See details below:

JSX transform

@wordpress/scripts defaults to the automatic JSX transform (runtime: 'automatic'), which compiles JSX to calls into react/jsx-runtime. WordPress registers this as the react-jsx-runtime script handle, but only from WP 6.6
onwards. On older versions the handle is undefined, causing a fatal JS error at runtime.

To fix this, the babel-loader rule from @wordpress/scripts is patched in webpack.config.js to prepend @babel/plugin-transform-react-jsx with runtime: 'classic'. Because Babel runs explicit plugins before preset plugins,
this transform fires first and converts all JSX to React.createElement calls, leaving nothing for the preset's automatic transform to process.

A ProvidePlugin entry injects React from @wordpress/element into any module that references it, so JSX files don't need an explicit import. wp-element has been available since WP 5.0, making this safe across all
supported versions.

Compatibility with PHP 7.4

While manually testing this on WP 5.6 and PHP 7.4, I noticed a fatal error related to str_contains being used (which is a PHP 8 function). Updated this.

I performed an audit to check for any other PHP 8 only features being used but didn't find any.
Manual testing the plugin didn't raise any issue either.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants