Skip to content

Fix/apiVersion 3 compatibility fixes#623

Merged
olethomas merged 7 commits intomainfrom
fix/api-version-3-compatibility
Mar 25, 2026
Merged

Fix/apiVersion 3 compatibility fixes#623
olethomas merged 7 commits intomainfrom
fix/api-version-3-compatibility

Conversation

@Sisanu
Copy link
Copy Markdown
Contributor

@Sisanu Sisanu commented Mar 25, 2026

Short introduction

This PR aims to improve WordPress apiVersion: 3 compatibility for the block theme by updating block metadata and adjusting how theme assets are enqueued across frontend/editor contexts, plus a couple of setup/documentation tweaks.

Changes:

Updated src/block.json to include a block name and explicit editor/view style/script entries using file:./... paths.
Refactored theme asset enqueuing to use enqueue_block_assets / enqueue_block_editor_assets and a shared load_theme_assets() helper.
Adjusted multisite URL update instructions and clarified an .env.example comment.

Description

Sisanu added 4 commits March 25, 2026 11:24
… handles conflicts that happen when the editor and view assets have the same handle. Removed the t2 extension dependency filter as that was preventing the load of assets in the eidtor iframe. Aim for the same versioning for both styles and scripts - avoid the filemtime if possible.
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR aims to improve WordPress apiVersion: 3 compatibility for the block theme by updating block metadata and adjusting how theme assets are enqueued across frontend/editor contexts, plus a couple of setup/documentation tweaks.

Changes:

  • Updated src/block.json to include a block name and explicit editor/view style/script entries using file:./... paths.
  • Refactored theme asset enqueuing to use enqueue_block_assets / enqueue_block_editor_assets and a shared load_theme_assets() helper.
  • Adjusted multisite URL update instructions and clarified an .env.example comment.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
packages/themes/block-theme/src/block.json Adds required block metadata and defines editor/view assets for apiVersion 3.
packages/themes/block-theme/includes/setup-theme.php Changes hooks and consolidates asset loading logic for frontend/editor contexts.
INSTALLATION.md Updates WP-CLI multisite URL replacement command.
.env.example Minor comment clarification for multisite env var.

Comment thread packages/themes/block-theme/includes/setup-theme.php
Comment thread packages/themes/block-theme/includes/setup-theme.php
Comment thread INSTALLATION.md Outdated
Comment thread packages/themes/block-theme/src/block.json Outdated
Comment thread packages/themes/block-theme/includes/setup-theme.php
$dep = $assets['dependencies'] ?? [];
$ver = $assets['version'] ?? \filemtime( $dir . 'editor.js' );
\wp_enqueue_script( $handle, $url . 'editor.js', $dep, $ver, true );
\wp_set_script_translations( $handle, 'block-theme', \get_template_directory() . '/languages' );
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is this needed? I think having the text domain in the style.css is enough, correct @luistinygod ?

Comment thread packages/themes/block-theme/includes/setup-theme.php
Comment thread packages/themes/block-theme/src/block.json Outdated
Comment thread packages/themes/block-theme/src/block.json Outdated
Copy link
Copy Markdown
Member

@stian-overasen stian-overasen left a comment

Choose a reason for hiding this comment

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

Other than not needing editorStyle and style in block.json, this looks good. 👍

olethomas and others added 2 commits March 25, 2026 13:40
Co-authored-by: Stian <stian@dekode.no>
Co-authored-by: Stian <stian@dekode.no>
@olethomas olethomas merged commit 3256c72 into main Mar 25, 2026
4 checks passed
@olethomas olethomas deleted the fix/api-version-3-compatibility branch March 25, 2026 12:42
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.

4 participants