Skip to content

Icons: Move the public property from icons to collections - #83277

Open
t-hamano wants to merge 10 commits into
trunkfrom
update/icon-collection-public
Open

t-hamano wants to merge 10 commits into
trunkfrom
update/icon-collection-public

Conversation

@t-hamano

@t-hamano t-hamano commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

Note

This pull request is a prerequisite for #83261.

What?

See #83261 (comment).

Moves the icon registry's public property from individual icons to collections.

Why?

WordPress/wordpress-develop#12270 uses the icon registry for the admin bar and sidebar. #82634 introduced an icon-level public option so those icons could remain available to PHP without appearing in the REST API or Icon block.

However, consumers unregistering the core collection to customize the Icon block would also remove the dashboard icons. #83261 proposes a separate core-admin collection to address this. With that separation, visibility can be configured for the entire collection instead of each icon.

How?

  • Adds public to wp_register_icon_collection(), defaulting to true. Non-public collections and their icons are excluded from REST responses, while their icons remain available through wp_get_icon().
  • Removes the icon-level registry option and reverts the tri-state manifest behavior introduced in Icons: Allow icons to ship to WordPress Core without exposing them in the Icon block  #82634, which has not shipped in a Gutenberg plugin release. The manifest's public flag continues to control which icons ship to Core.

Testing Instructions

  1. Temporarily add 'public' => false to the core collection's registration arguments in gutenberg_register_default_icon_collections() in lib/icons.php.
--- a/lib/icons.php
+++ b/lib/icons.php
@@ -15,6 +15,7 @@
 		array(
 			'label'       => __( 'WordPress', 'gutenberg' ),
 			'description' => __( 'Core icon collection.', 'gutenberg' ),
+			'public'      => false,
 		)
 	);
 }
  1. Reload the post editor and run the following in the browser console. Confirm that the collections omit core and the icons omit every core/ icon:
await wp.apiFetch( { path: '/wp/v2/icon-collections' } );
await wp.apiFetch( { path: '/wp/v2/icons' } );
  1. Confirm that requesting the non-public collection's icons rejects with a 404 (rest_icon_collection_not_found):
await wp.apiFetch( { path: '/wp/v2/icons/core' } );
  1. Confirm that wp_get_icon( 'core/plus' ) still returns SVG markup in PHP.
  2. Remove the temporary public argument and reload. Confirm that the core collection and its icons are exposed again.

Use of AI Tools

Codex was used to inspect the changes, run validation, and prepare this PR description.

@github-actions

github-actions Bot commented Sep 21, 2026

Copy link
Copy Markdown

🤖 PR meta 🤖

📦 Bundle size

Size Change: 0 B

Total Size: 8.21 MB

040514b Run

⚡ Performance

Show the results

Client side metrics exclude the server response time.

front-end-block-theme

Metric 881dab5 trunk % Change
timeToFirstByte 55.15 ms +14.42% -2.09% 56.05 ms +10.7% -3.39% -1.61%
largestContentfulPaint 96 ms +2.08% -8.33% 96 ms +4.17% -8.33% 0%
lcpMinusTtfb 34.15 ms +21.67% -3.22% 34.95 ms +21.6% -6.01% -2.29%
wpBeforeTemplate 27.42 ms +19.33% -0.55% 27.76 ms +14.66% -2.77% -1.22%
wpTemplate 24.27 ms +3.54% -5.36% 23.7 ms +2.95% -1.81% 2.41%
wpTotal 51.38 ms +14.75% -1.99% 52.47 ms +9.89% -3.74% -2.08%
wpMemoryUsage 7.56 MB +0% -0% 7.53 MB +0% -0% 0.42%
wpDbQueries 17 +0% -0% 17 +0% -0% 0%

front-end-classic-theme

Metric 881dab5 trunk % Change
timeToFirstByte 46.3 ms +5.18% -1.51% 42.4 ms +10.02% -2.83% 9.2%
largestContentfulPaint 100 ms +6% -0% 88 ms +6.82% -0% 13.64%
lcpMinusTtfb 54.4 ms +0.28% -1.29% 46.2 ms +3.9% -2.27% 17.75%
wpBeforeTemplate 25.58 ms +8.05% -1.64% 25.62 ms +13.08% -1.8% -0.16%
wpTemplate 17.74 ms +2.25% -1.8% 13.65 ms +3.81% -3.74% 29.96%
wpTotal 43.25 ms +5.94% -1.16% 39.7 ms +10.48% -2.77% 8.94%
wpMemoryUsage 6.18 MB +0% -0% 6.01 MB +0% -0% 2.83%
wpDbQueries 14 +0% -0% 10 +0% -0% 40%

media-processing

Metric 881dab5 trunk % Change
mediaProcessingJpeg 395.9 ms +3.68% -0.39% 393.55 ms +0.56% -0.16% 0.6%
mediaProcessingAvif 6054.86 ms +0.18% -0.05% 6072.71 ms +0.09% -0.12% -0.29%
mediaProcessingJpegToAvif 4155.47 ms +0.07% -0.07% 4204.82 ms +0.2% -0.27% -1.17%

media-upload

Metric 881dab5 trunk % Change
jpegUploadProcessing 1446.88 ms +33.25% -1.98% 1423.23 ms +0.71% -0.4% 1.66%
pngUploadProcessing 207.4 ms +1.69% -4.38% 209.28 ms +3.45% -4.6% -0.9%
largeJpegUploadProcessing 1403.69 ms +0.26% -0.43% 1410.7 ms +1.22% -0.36% -0.5%
multipleImageUploadProcessing 1559.82 ms +1.22% -1.28% 1561.89 ms +0.49% -0.62% -0.13%

post-editor

Metric 881dab5 trunk % Change
serverResponse 493.14 ms +7.42% -3.25% 509.57 ms +5.97% -2.23% -3.22%
firstPaint 258.85 ms +17.93% -27.12% 223.35 ms +4.53% -9.81% 15.89%
domContentLoaded 1129.8 ms +1.86% -2.5% 1127.45 ms +0.77% -0.24% 0.21%
loaded 1131.18 ms +1.87% -2.47% 1128.85 ms +0.76% -0.23% 0.21%
firstContentfulPaint 459.57 ms +4.27% -1.44% 452.12 ms +2.34% -7.05% 1.65%
firstBlock 3376.5 ms +0.7% -1.52% 3378.71 ms +0.47% -0.45% -0.07%
type 22.15 ms +8.08% -5.19% 21.29 ms +8.13% -3.57% 4.04%
typeWithoutInspector 21.3 ms +4.51% -1.55% 21.57 ms +5.38% -7.05% -1.25%
typeWithTopToolbar 26.09 ms +9.81% -3.83% 26.07 ms +1.34% -8.59% 0.08%
typeContainer 8.72 ms +8.14% -6.31% 8.88 ms +5.29% -11.15% -1.8%
focus 75.4 ms +7.19% -8.32% 78.34 ms +11.14% -0.73% -3.75%
firstFocus 222.12 ms +0% -0% 205.75 ms +0% -0% 7.96%
selectAll 534.46 ms +1.69% -5.56% 528.93 ms +1.66% -0.32% 1.05%
listViewOpen 76.66 ms +8.54% -2.73% 74.88 ms +17.6% -7.67% 2.38%
inserterOpen 23.92 ms +6.1% -9.95% 22.89 ms +2.62% -7.38% 4.5%
inserterHover 3.13 ms +13.42% -10.54% 3.35 ms +5.67% -10.15% -6.57%
inserterSearch 8.02 ms +13.59% -8.23% 8.26 ms +7.02% -8.84% -2.91%
loadPatterns 660.64 ms +2.2% -5.28% 634.44 ms +9.3% -2.34% 4.13%
wpTotal 482.92 ms +7.59% -3.31% 499.43 ms +6.13% -2.19% -3.31%
wpMemoryUsage 13.09 MB +0% -0% 13.06 MB +0% -0% 0.26%
wpDbQueries 54 +0% -1.85% 54 +0% -1.85% 0%

site-editor

Metric 881dab5 trunk % Change
serverResponse 393.99 ms +2.73% -5.75% 385.37 ms +4.67% -1.71% 2.24%
firstPaint 209.09 ms +87.3% -11.99% 236.79 ms +42.92% -23.19% -11.7%
domContentLoaded 976.24 ms +0.36% -1.06% 989.03 ms +1.31% -2.24% -1.29%
loaded 977.13 ms +0.38% -1.05% 989.94 ms +1.31% -2.22% -1.29%
firstContentfulPaint 391.66 ms +3.1% -1.9% 403.22 ms +1.52% -2.05% -2.87%
firstBlock 3467.31 ms +1.34% -1.07% 3467.3 ms +1.28% -1.45% 0%
type 17.46 ms +6.24% -0.86% 17.6 ms +8.41% -5.28% -0.8%
navigate 97.38 ms +8.57% -3.77% 101.94 ms +5.53% -5.21% -4.47%
loadPatterns 1308.47 ms +8.64% -12.95% 1148.61 ms +3.03% -7.41% 13.92%
loadPages 1060.76 ms +0.39% -0.89% 1075.97 ms +2.76% -2.23% -1.41%
wpTotal 384.27 ms +2.74% -5.92% 375.55 ms +4.8% -1.78% 2.32%
wpMemoryUsage 12.05 MB +0% -0% 12.02 MB +0% -0% 0.28%
wpDbQueries 43 +2.33% -0% 43.5 +1.15% -1.15% -1.15%

040514b Run

@github-actions github-actions Bot added the [Package] Icons /packages/icons label Sep 21, 2026
@t-hamano t-hamano changed the title Icons: Move REST API visibility from icons to collections Icons: Move the public property from icons to collections Sep 21, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is for backward compatibility. I add a dedicated collection registry for Gutenberg to ensure that the latest registry supporting public properties is always used across all WordPress versions supported by the Gutenberg plugin, regardless of the state of the core collection registry.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Similar to the collection registry, this is also intended to override the core REST controller.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

Review effort: Balanced
Findings: None


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Co-Authored-By: Claude <noreply@anthropic.com>
@t-hamano
t-hamano marked this pull request as ready for review September 21, 2026 13:30
@t-hamano
t-hamano requested review from fushar, mcsf and tyxla September 21, 2026 13:30
@github-actions

github-actions Bot commented Sep 21, 2026

Copy link
Copy Markdown

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: t-hamano <wildworks@git.wordpress.org>
Co-authored-by: fushar <fushar@git.wordpress.org>

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

@t-hamano t-hamano added [Type] Enhancement A suggestion for improvement. [Feature] Icons Related to Icon registration API and Icon REST API labels Sep 21, 2026
@fushar

fushar commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

I haven't reviewed the code in details, but: maybe it's much easier to test if we also add the core-admin/ registration in this PR? Or did you intend to do it as a separate PR?

I think it will also easier to review, as then manifest.json changes will have public: false changed to admin: true 🤔

@t-hamano

Copy link
Copy Markdown
Contributor Author

Personally, I wanted to split the PR—that is, the core commits—into two, because each PR represents a separate enhancement.

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

Labels

[Feature] Icons Related to Icon registration API and Icon REST API [Package] Icons /packages/icons [Type] Enhancement A suggestion for improvement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants