Skip to content

Conversation

@aaronrobertshaw
Copy link

Trac ticket: https://core.trac.wordpress.org/ticket/64195

This PR brings the changes from the following Gutenberg PRs to core:

WordPress/gutenberg#72916

Description

Prevents an issue where block level presets do not work correctly when:

  • Default presets are disabled
  • Slug matches the default preset

The result is missing presets in the settings and editor UI.

Testing

For each theme.json example config below:

  1. Ensure default presets for the feature being testing is on at the global level
  2. Add the block level preset config to your theme.json file
  3. Confirm in the editor the expected presets are available generally and at the block level

Duotone

In the image block, only the "Dark grayscale" duotone preset should be available

{
	"version": 3,
	"appearanceTools": true,
	"settings": {
		"blocks":{
			"core/image": {
				"color": {
					"defaultDuotone": false,
					"duotone": [
						{
							"name": "Dark grayscale",
							"colors": [ "#000000", "#7f7f7f" ],
							"slug": "dark-grayscale"
						}
					]
				}
			}
		}
	}
}

Shadow

In the image block, only the "Natural" shadow preset should be available

{
	"version": 3,
	"settings": {
		"appearanceTools": true,
		"blocks":{
			"core/image": {
				"shadow": {
					"defaultPresets": false,
					"presets": [
						{
							"name": "Natural",
							"slug": "natural",
							"shadow": "6px 6px 9px rgba(0, 0, 0, 0.2)"
						}
					]
				}
			}
		}
	}
}

Font Size

In the Paragraph block, only the "Small" duotone preset should be available

{
	"version": 3,
	"settings": {
		"appearanceTools": true,
		"blocks":{
			"core/paragraph": {
				"typography": {
					"defaultFontSizes": false,
					"fontSizes": [
						{
							"name": "Small",
							"slug": "small",
							"size": "13px"
						}
					]
				}
			}
		}
	}
}

Screenshots or screencast

Before After
Screenshot 2025-11-03 at 7 23 34 pm Screenshot 2025-11-03 at 7 20 28 pm

This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.

@aaronrobertshaw aaronrobertshaw marked this pull request as ready for review November 4, 2025 11:10
@github-actions
Copy link

github-actions bot commented Nov 4, 2025

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

Core Committers: Use this line as a base for the props when committing in SVN:

Props aaronrobertshaw.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@aaronrobertshaw aaronrobertshaw force-pushed the fix/default-preset-handling-at-block-level branch from 7c05430 to 3b3d7de Compare November 4, 2025 11:12
@aaronrobertshaw aaronrobertshaw self-assigned this Nov 4, 2025
@aaronrobertshaw aaronrobertshaw added bug php Pull requests that update php code labels Nov 4, 2025
@github-actions
Copy link

github-actions bot commented Nov 4, 2025

Test using WordPress Playground

The changes in this pull request can previewed and tested using a WordPress Playground instance.

WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser.

Some things to be aware of

  • The Plugin and Theme Directories cannot be accessed within Playground.
  • All changes will be lost when closing a tab with a Playground instance.
  • All changes will be lost when refreshing the page.
  • A fresh instance is created each time the link below is clicked.
  • Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
    it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.

For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.

Test this pull request with WordPress Playground.

Copy link
Member

@ramonjd ramonjd left a comment

Choose a reason for hiding this comment

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

LGTM

Tested in the same way as WordPress/gutenberg#72916

Screenshot 2025-11-05 at 10 29 01 am Screenshot 2025-11-05 at 10 28 55 am Screenshot 2025-11-05 at 10 29 07 am

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

Labels

bug php Pull requests that update php code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants