Skip to content

Query: Remove content role from block#75760

Merged
talldan merged 1 commit intotrunkfrom
remove/content-role-from-query-block
Feb 20, 2026
Merged

Query: Remove content role from block#75760
talldan merged 1 commit intotrunkfrom
remove/content-role-from-query-block

Conversation

@talldan
Copy link
Contributor

@talldan talldan commented Feb 20, 2026

What?

Fixes an issue for the Query block where in patterns it allowed content to be inserted at the root of a query block.

Why?

The query block has a very specific internal structure with Post Template, No Results and Pagination, so allowing content blocks to be inserted in ContentOnly mode at the root level doesn't really work so well.

When used in a pattern the block prioritises allowing the user to switch between different patterns instead, which continues to work in this PR.

For deeper changes the user can 'Edit pattern' or detach/disconnect, which is still available after this change.

How?

Remove contentRole: true property from block supports

Testing Instructions

  1. Open up a template like 'Blog home' in TT5 that contains a query pattern
  2. Note that 'Change design' is still available on the toolbar for the pattern
  3. With the pattern selected, note that there's no + appender at the end of the pattern in this PR, while there is in trunk
  4. Try selecting a 'Sorry, but nothing was found.' paragraph if your query pattern has it (if not you may need to change design to one that does have this) and note that it's still editable in this PR as it is in trunk.
  5. Similarly it should be possible to update the 'Read more' excerpt text, but you'll need to have a design selected that has an Excerpt

Screenshots

Before

(with the query pattern selected, there's an appender that allows adding blocks at the root of a query)

Screenshot 2026-02-20 at 12 29 25 pm

After

(no appender with the query pattern selected)

Screenshot 2026-02-20 at 12 28 23 pm

@talldan talldan self-assigned this Feb 20, 2026
@talldan talldan added [Type] Bug An existing feature does not function as intended [Block] Query Loop Affects the Query Loop Block Backport to Gutenberg RC Pull request that needs to be backported to a Gutenberg release candidate (RC) labels Feb 20, 2026
@github-actions github-actions bot added the [Package] Block library /packages/block-library label Feb 20, 2026
@github-actions
Copy link

github-actions bot commented Feb 20, 2026

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.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: talldan <talldanwp@git.wordpress.org>
Co-authored-by: tellthemachines <isabel_brison@git.wordpress.org>
Co-authored-by: ramonjd <ramonopoly@git.wordpress.org>
Co-authored-by: fabiankaegy <fabiankaegy@git.wordpress.org>

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

@talldan talldan added the Backport to WP 7.0 Beta/RC Pull request that needs to be backported to the WordPress major release that's currently in beta label Feb 20, 2026
Copy link
Contributor

@tellthemachines tellthemachines left a comment

Choose a reason for hiding this comment

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

Thanks for fixing this! It's working well for me. Change design still showing for Query patterns:

Image

@talldan talldan force-pushed the remove/content-role-from-query-block branch from 2481a43 to 87e2f44 Compare February 20, 2026 04:53
@ramonjd
Copy link
Member

ramonjd commented Feb 20, 2026

Appreciate the troubleshooting and the fix 🙇🏻 LGTM

Thanks, folks!

Before I could insert any block in a posts pattern (containing a query block)

Screenshot 2026-02-20 at 3 50 31 pm

Now I cannot!

Screenshot 2026-02-20 at 3 49 03 pm

Checked nested patterns, and multiple query blocks inside a pattern

@fabiankaegy
Copy link
Member

Just clarifying (sorry didn't have the time to test this locally.)

With this change is it still possible to change all of the query parameters such as filters etc of the query block even when it is deeply nested inside a pattern? Because I thought that was why the contentRole was added to this block in the first place.

@talldan talldan force-pushed the remove/content-role-from-query-block branch from 87e2f44 to f563fed Compare February 20, 2026 06:48
@talldan
Copy link
Contributor Author

talldan commented Feb 20, 2026

With this change is it still possible to change all of the query parameters such as filters etc of the query block even when it is deeply nested inside a pattern? Because I thought that was why the contentRole was added to this block in the first place.

Do you have a link to a PR or issue that discusses that? It didn't show those controls before and it doesn't after.

@github-actions
Copy link

Flaky tests detected in f563fed.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/22214432500
📝 Reported issues:

@fabiankaegy
Copy link
Member

@talldan okay I did some more digging. This actually is not working like I remembered in 6.9 when you use templateLock: contentOnly. However if you programmatically change the blocks rendering mode to the contentOnly one it does still allow selection & changing of the query parameters. Which is really powerful because the query properties are content not design.

CleanShot.2026-02-20.at.08.16.16.mp4

I realize this is not the core experience and so it makes sense to iterate on it. I guess I just got lucky that the current state of it with the contentRole added does make this exact use case possible.

It does mean however that I think we should look at finding a way to make the query block selectable in the contentOnly mode regardless because like I said before, the query properties are content.

@fabiankaegy
Copy link
Member

But does the "change design" also still appear when the query is nested in a larger pattern? Right now the testing examples all seem to only show it when the query is the top level pattern block 🤔 Because that is why the role was actually added in the first place: #71686

@talldan
Copy link
Contributor Author

talldan commented Feb 20, 2026

@fabiankaegy It doesn't do that in trunk either:
Screenshot 2026-02-20 at 3 35 28 pm

I'd suggest making an issue if it's a bug.

@talldan
Copy link
Contributor Author

talldan commented Feb 20, 2026

like I said before, the query properties are content.

I really need to know where this was discussed and implemented. None of the attributes have a content role, so I'm not convinced it ever was implemented. 😄

I'll move ahead and merge the PR, because it doesn't seem to regress anything in trunk and it does fix an issue.

If there are further query block bugs, lets track them in issues and aim to get them fixed for 7.0. 👍

@talldan talldan merged commit 82d3b66 into trunk Feb 20, 2026
38 checks passed
@talldan talldan deleted the remove/content-role-from-query-block branch February 20, 2026 07:53
@github-actions github-actions bot added this to the Gutenberg 22.7 milestone Feb 20, 2026
@github-actions github-actions bot removed the Backport to WP 7.0 Beta/RC Pull request that needs to be backported to the WordPress major release that's currently in beta label Feb 20, 2026
gutenbergplugin pushed a commit that referenced this pull request Feb 20, 2026
Co-authored-by: talldan <talldanwp@git.wordpress.org>
Co-authored-by: tellthemachines <isabel_brison@git.wordpress.org>
Co-authored-by: ramonjd <ramonopoly@git.wordpress.org>
@github-actions github-actions bot added the Backported to WP Core Pull request that has been successfully merged into WP Core label Feb 20, 2026
@github-actions
Copy link

I just cherry-picked this PR to the wp/7.0 branch to get it included in the next release: ed9fbde

pento pushed a commit to WordPress/wordpress-develop that referenced this pull request Feb 20, 2026
CI run: #10988.

See #64595.

---

I've included a log of the Gutenberg changes with the following command:

```
git log --reverse --format="- %s" b441348bb7e05af351c250b74283f253acaf9138..23b566c72e9c4a36219ef5d6e62890f05551f6cb | sed 's|#\([0-9][0-9]*\)|https://github.com/WordPress/gutenberg/pull/\1|g; /github\.com\/WordPress\/gutenberg\/pull/!d' | pbcopy
```

- Remove experimental property from Icon block (WordPress/gutenberg#75742)
- Real-time collab editing: Fix undo E2E test (WordPress/gutenberg#75740)
- Snackbar: Fix scaling issue with snackbars that update their content via a common id (WordPress/gutenberg#75709)
- Vips and worker-threads packages: remove private flag so that packages can be published to npm (WordPress/gutenberg#75752)
- Update wordpress/vips in root package.json to use a relative path (WordPress/gutenberg#75758)
- Fix change-detection and new-post E2E tests after RTC enabled by default (WordPress/gutenberg#75751)
- Query: Remove content role from block (WordPress/gutenberg#75760)
- `ToggleGroupControl`: Make unselected item color consistent across all variants (WordPress/gutenberg#75737)
- Icon-block: fix global-styles selectors (WordPress/gutenberg#75724)
- RTC: Add cap check for single taxonomy term entities (WordPress/gutenberg#75708)
- Core Data: Create icons entity (WordPress/gutenberg#75773)


git-svn-id: https://develop.svn.wordpress.org/trunk@61705 602fd350-edb4-49c9-b593-d223f7449a82
markjaquith pushed a commit to markjaquith/WordPress that referenced this pull request Feb 20, 2026
CI run: WordPress/wordpress-develop#10988.

See #64595.

---

I've included a log of the Gutenberg changes with the following command:

```
git log --reverse --format="- %s" b441348bb7e05af351c250b74283f253acaf9138..23b566c72e9c4a36219ef5d6e62890f05551f6cb | sed 's|#\([0-9][0-9]*\)|https://github.com/WordPress/gutenberg/pull/\1|g; /github\.com\/WordPress\/gutenberg\/pull/!d' | pbcopy
```

- Remove experimental property from Icon block (WordPress/gutenberg#75742)
- Real-time collab editing: Fix undo E2E test (WordPress/gutenberg#75740)
- Snackbar: Fix scaling issue with snackbars that update their content via a common id (WordPress/gutenberg#75709)
- Vips and worker-threads packages: remove private flag so that packages can be published to npm (WordPress/gutenberg#75752)
- Update wordpress/vips in root package.json to use a relative path (WordPress/gutenberg#75758)
- Fix change-detection and new-post E2E tests after RTC enabled by default (WordPress/gutenberg#75751)
- Query: Remove content role from block (WordPress/gutenberg#75760)
- `ToggleGroupControl`: Make unselected item color consistent across all variants (WordPress/gutenberg#75737)
- Icon-block: fix global-styles selectors (WordPress/gutenberg#75724)
- RTC: Add cap check for single taxonomy term entities (WordPress/gutenberg#75708)
- Core Data: Create icons entity (WordPress/gutenberg#75773)

Built from https://develop.svn.wordpress.org/trunk@61705


git-svn-id: http://core.svn.wordpress.org/trunk@61013 1a063a9b-81f0-0310-95a4-ce76da25c4cd
@ockham ockham modified the milestones: Gutenberg 22.7, Gutenberg 22.6 Feb 23, 2026
ockham pushed a commit that referenced this pull request Feb 23, 2026
Co-authored-by: talldan <talldanwp@git.wordpress.org>
Co-authored-by: tellthemachines <isabel_brison@git.wordpress.org>
Co-authored-by: ramonjd <ramonopoly@git.wordpress.org>
@ockham
Copy link
Contributor

ockham commented Feb 23, 2026

I just cherry-picked this PR to the release/22.6 branch to get it included in the next release: ae22a41

@ockham ockham removed the Backport to Gutenberg RC Pull request that needs to be backported to a Gutenberg release candidate (RC) label Feb 23, 2026
scruffian pushed a commit that referenced this pull request Feb 23, 2026
Co-authored-by: talldan <talldanwp@git.wordpress.org>
Co-authored-by: tellthemachines <isabel_brison@git.wordpress.org>
Co-authored-by: ramonjd <ramonopoly@git.wordpress.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Backported to WP Core Pull request that has been successfully merged into WP Core [Block] Query Loop Affects the Query Loop Block [Package] Block library /packages/block-library [Type] Bug An existing feature does not function as intended

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants