Skip to content

Icons: Allow icons to ship to WordPress Core without exposing them in the Icon block - #82634

Open
fushar wants to merge 2 commits into
trunkfrom
icon-public-false
Open

Icons: Allow icons to ship to WordPress Core without exposing them in the Icon block #82634
fushar wants to merge 2 commits into
trunkfrom
icon-public-false

Conversation

@fushar

@fushar fushar commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Part of #82723

What

This PR makes the public property in packages/icons/src/manifest.json a tri-state, so an icon can be shipped to WordPress Core without also becoming selectable in the Icon block.

Its new meaning as follows:

public Shipped to Core? In the REST API / Icon block? wp_get_icon()
omitted no no no
true yes yes yes
false yes no yes

This PR also adds public: false to the core/wordpress icon as a proof of concept.

Why

This implements the suggested solution from #79451. With this, we can have the admin screens to show certain icons via wp_get_icon(), without allowing such icons to be selectable in the Icon block, as some icons might not be useful to use in a post content.

How

Build

packages/icons/lib/generate-manifest-php.cjs reads manifest.json and generates manifest.php. Previously it only generated icons that have public: true. Now:

  • It also generates icons that have public: false.
  • For such icons, it marks them as public: false as well in manifest.php.

Registry (WP_Icons_Registry[_Gutenberg])

It now allows public as accepted property. As a back-compat, if a plugin / code already registers icons without public property, it will be treated as true.

REST controller (WP_REST_Icons_Controller[_Gutenberg])

It skips icons which have explicit public: false, in both get_items() and get_icon():

  • get_items(): the GB side already overrides and reimplements the parent function, so the public: false check is added on both WP_REST_Icons_Controller and WP_REST_Icons_Controller_Gutenberg.
  • get_icon(): the GB side hasn't overridden it yet, so we add one in WP_REST_Icons_Controller_Gutenberg, call the parent function, and return 404 if it has public: false.

Testing Instructions

See the testing instructions in: #79451.

Use of AI Tools

I used Claude Code Opus to write and review these changes, then checked and validated the changes myself.

@github-actions github-actions Bot added the [Package] Icons /packages/icons label Sep 9, 2026
@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown

🤖 PR meta 🤖

📦 Bundle size

Size Change: 0 B

Total Size: 8.06 MB

beed60f Run

⚡ Performance

Show the results

Client side metrics exclude the server response time.

front-end-block-theme

Metric 40ac123 trunk % Change
timeToFirstByte 42.65 ms +9.14% -5.63% 42.7 ms +3.04% -3.75% -0.12%
largestContentfulPaint 72 ms +8.33% -5.56% 68 ms +8.82% -0% 5.88%
lcpMinusTtfb 27.7 ms +23.47% -7.04% 26.8 ms +14.55% -5.6% 3.36%
wpBeforeTemplate 20.05 ms +11.02% -3.29% 20.17 ms +2.08% -2.48% -0.59%
wpTemplate 19.06 ms +3.2% -6.3% 19.21 ms +2.03% -6.35% -0.78%
wpTotal 39.36 ms +9.32% -4.88% 39.53 ms +3.36% -3.95% -0.43%
wpMemoryUsage 7.53 MB +0% -0% 7.49 MB +0% -0% 0.46%
wpDbQueries 17 +0% -0% 17 +0% -0% 0%

front-end-classic-theme

Metric 40ac123 trunk % Change
timeToFirstByte 31.2 ms +5.93% -2.56% 32.35 ms +1.85% -3.71% -3.55%
largestContentfulPaint 74 ms +5.41% -2.7% 76 ms +0% -5.26% -2.63%
lcpMinusTtfb 42.3 ms +6.62% -2.13% 42 ms +3.93% -4.29% 0.71%
wpBeforeTemplate 17.51 ms +5.65% -3.54% 17.64 ms +2.72% -1.53% -0.74%
wpTemplate 11.14 ms +7.09% -1.71% 12.01 ms +2% -8.66% -7.24%
wpTotal 28.71 ms +6.13% -2.75% 30 ms +1.03% -4.5% -4.3%
wpMemoryUsage 5.52 MB +0% -0% 5.48 MB +0% -0% 0.65%
wpDbQueries 14 +0% -0% 14 +0% -0% 0%

media-processing

Metric 40ac123 trunk % Change
mediaProcessingJpeg 330.2 ms +2.32% -0.87% 328.31 ms +4.23% -0.5% 0.58%
mediaProcessingAvif 4768.68 ms +0.25% -0.17% 4784.43 ms +0.15% -0.07% -0.33%
mediaProcessingJpegToAvif 3290.55 ms +0.06% -0.41% 3279.29 ms +0.36% -0.06% 0.34%

media-upload

Metric 40ac123 trunk % Change
jpegUploadProcessing 1395.56 ms +0.82% -0.7% 1385.68 ms +1.12% -0.69% 0.71%
pngUploadProcessing 177.92 ms +3.45% -7.52% 166.97 ms +9.99% -1.99% 6.56%
largeJpegUploadProcessing 1394.28 ms +0.79% -0.74% 1376.89 ms +0.42% -0.37% 1.26%
multipleImageUploadProcessing 1451.49 ms +1.05% -0.45% 1450.68 ms +0.3% -1.08% 0.06%

post-editor

Metric 40ac123 trunk % Change
serverResponse 522.8 ms +4.47% -4.67% 498.07 ms +5.06% -5.76% 4.97%
firstPaint 253.71 ms +6.26% -9.7% 273.93 ms +7.62% -19.15% -7.38%
domContentLoaded 1303.09 ms +0.72% -0.97% 1293.33 ms +0.78% -0.63% 0.75%
loaded 1304.44 ms +0.72% -0.96% 1294.79 ms +0.77% -0.65% 0.75%
firstContentfulPaint 442.93 ms +3.01% -1.56% 432.41 ms +3.01% -3.19% 2.43%
firstBlock 3611.48 ms +0.53% -0.77% 3599.79 ms +0.4% -0.19% 0.32%
type 14.46 ms +10.03% -2.07% 15.14 ms +6.67% -5.22% -4.49%
typeWithoutInspector 15.36 ms +5.27% -4.04% 15.36 ms +0.85% -8.4% 0%
typeWithTopToolbar 19.18 ms +6.36% -8.24% 18.02 ms +12.04% -2.16% 6.44%
typeContainer 9.14 ms +14.55% -13.57% 9.04 ms +8.41% -3.87% 1.11%
focus 81.23 ms +10.7% -8.29% 80.05 ms +5.7% -9.32% 1.47%
firstFocus 191.67 ms +0% -0% 206.03 ms +0% -0% -6.97%
selectAll 591.07 ms +0.56% -3.11% 591.75 ms +2.84% -2.88% -0.11%
listViewOpen 69.46 ms +7.92% -4.61% 69.3 ms +3.32% -9.52% 0.23%
inserterOpen 23.03 ms +5.34% -10.68% 22.52 ms +15.32% -5.37% 2.26%
inserterHover 3.48 ms +11.49% -6.03% 3.7 ms +15.68% -12.43% -5.95%
inserterSearch 8.48 ms +9.08% -5.54% 8.94 ms +10.4% -5.7% -5.15%
loadPatterns 633.11 ms +2.63% -2.04% 625.92 ms +1.71% -3.77% 1.15%
wpTotal 512.85 ms +4.62% -4.75% 487.92 ms +5.31% -5.86% 5.11%
wpMemoryUsage 13.06 MB +0% -0% 13.03 MB +0% -0% 0.28%
wpDbQueries 54 +0% -1.85% 54 +0% -1.85% 0%

site-editor

Metric 40ac123 trunk % Change
serverResponse 424.09 ms +3.44% -5.03% 396.65 ms +6.73% -6.41% 6.92%
firstPaint 307.23 ms +43.19% -25.66% 259.23 ms +8.47% -12.02% 18.52%
domContentLoaded 1355.25 ms +1.73% -2.05% 1363.96 ms +1.06% -2.92% -0.64%
loaded 1356.58 ms +1.71% -2.06% 1365.25 ms +1.06% -2.92% -0.64%
firstContentfulPaint 437.32 ms +1.05% -2.51% 424.17 ms +1.51% -1.16% 3.1%
firstBlock 4314.86 ms +1.19% -1.3% 4245.62 ms +1.68% -0.56% 1.63%
type 14.76 ms +9.42% -1.22% 17.11 ms +23.44% -6.84% -13.73%
navigate 99.68 ms +13.74% -4.37% 102.65 ms +5.27% -7.82% -2.89%
loadPatterns 1454.44 ms +6.45% -6.71% 1448.41 ms +9.55% -9.96% 0.42%
loadPages 1104.17 ms +0.93% -1.46% 1129.79 ms +0.75% -4.31% -2.27%
wpTotal 413.23 ms +3.65% -5.11% 385.66 ms +6.92% -6.57% 7.15%
wpMemoryUsage 12.07 MB +0% -0% 12.04 MB +0% -0% 0.31%
wpDbQueries 43 +2.33% -0% 43 +2.33% -0% 0%

beed60f Run

@fushar
fushar force-pushed the icon-public-false branch 2 times, most recently from dc2e30a to 6ded051 Compare September 9, 2026 07:38
@fushar fushar changed the title Icons: Add a non-public state to the public manifest property Icons: Allow icons to ship to WordPress Core without exposing them in the Icon block Sep 9, 2026
@fushar
fushar force-pushed the icon-public-false branch 2 times, most recently from 402e768 to a087ca3 Compare September 9, 2026 09:06
fushar added a commit that referenced this pull request Sep 9, 2026
Marks the icons that WordPress/wordpress-develop#12270
adds to Core's icon library as `"public": false`: they are shipped and
registered for server-side use, but stay out of the icons REST API and so
out of the Icon block.

brush, dashboard, link, media, page, pin, plugins, post, sites, tool, update

`wordpress` is the twelfth icon that Core PR needs. It is already flagged
by #82634, which introduces the non-public state and uses it as its first
consumer, so it is not repeated here.

`false` rather than `true` because these are admin chrome, not post
content. Promoting an icon later is trivial; demoting one is a breaking
change.
`public` in `packages/icons/src/manifest.json` becomes a tri-state:

- omitted: the icon stays in the JS library and is not shipped to core
- `true`:  shipped to core and exposed through the icons REST API, which
           makes it selectable in the Icon block
- `false`: shipped to core and registered, but hidden from the REST API.
           Reachable server-side via `wp_get_icon()`.

Until now `public` was a build-time filter only, so an icon could not be
shipped to core without also appearing in the Icon block. The flag is now
carried into `manifest.php` (emitted only when `false`, so today's
generated file is unchanged) and honoured by the registry and the icons
REST controller.

`bin/build-plugin-zip.sh` needed a matching fix: `jq select(.public)` is
falsy for `false`, so a non-public icon would have kept its manifest entry
while its SVG was pruned from the WordPress Core build.

No icon data changes here.
fushar added a commit that referenced this pull request Sep 9, 2026
Marks the icons that WordPress/wordpress-develop#12270
adds to Core's icon library as `"public": false`: they are shipped and
registered for server-side use, but stay out of the icons REST API and so
out of the Icon block.

brush, dashboard, link, media, page, pin, plugins, post, sites, tool, update

`wordpress` is the twelfth icon that Core PR needs. It is already flagged
by #82634, which introduces the non-public state and uses it as its first
consumer, so it is not repeated here.

`false` rather than `true` because these are admin chrome, not post
content. Promoting an icon later is trivial; demoting one is a breaking
change.
@fushar
fushar marked this pull request as ready for review September 9, 2026 15:09
@github-actions

github-actions Bot commented Sep 9, 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: fushar <fushar@git.wordpress.org>
Co-authored-by: scruffian <scruffian@git.wordpress.org>

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

@fushar fushar added the [Type] Enhancement A suggestion for improvement. label Sep 9, 2026
@fushar fushar self-assigned this Sep 9, 2026
fushar added a commit that referenced this pull request Sep 10, 2026
Marks the icons that WordPress/wordpress-develop#12270
adds to Core's icon library as `"public": false`: they are shipped and
registered for server-side use, but stay out of the icons REST API and so
out of the Icon block.

brush, dashboard, link, media, page, pin, plugins, post, sites, tool, update

`wordpress` is the twelfth icon that Core PR needs. It is already flagged
by #82634, which introduces the non-public state and uses it as its first
consumer, so it is not repeated here.

`false` rather than `true` because these are admin chrome, not post
content. Promoting an icon later is trivial; demoting one is a breaking
change.
fushar added a commit that referenced this pull request Sep 10, 2026
Marks the icons that WordPress/wordpress-develop#12270
adds to Core's icon library as `"public": false`: they are shipped and
registered for server-side use, but stay out of the icons REST API and so
out of the Icon block.

brush, dashboard, link, media, page, pin, plugins, post, sites, tool, update

`wordpress` is the twelfth icon that Core PR needs. It is already flagged
by #82634, which introduces the non-public state and uses it as its first
consumer, so it is not repeated here.

`false` rather than `true` because these are admin chrome, not post
content. Promoting an icon later is trivial; demoting one is a breaking
change.
Comment thread bin/build-plugin-zip.sh
cd packages/icons/src
non_public_icons=$(comm -13 \
<(jq -r "map(select(.public) | .filePath)[]" manifest.json | sort) \
<(jq -r "map(select(.public != null) | .filePath)[]" manifest.json | sort) \

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.

Do we need better validation here? A "public": "false" typo would keep the SVG in the core zip .

@scruffian scruffian 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.

This looks good. One minor comment but nothing that should stop this merging.

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

Labels

[Package] Icons /packages/icons [Type] Enhancement A suggestion for improvement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants