#66087 closed enhancement (fixed)
Icons: Allow registering icons that are hidden from the REST API
| Reported by: | fushar | Owned by: | mcsf |
|---|---|---|---|
| Priority: | normal | Milestone: | 7.2 |
| Component: | REST API | Version: | |
| Severity: | normal | Keywords: | has-patch has-unit-tests |
| Cc: | Focuses: |
Description
To support replacing Dashicons with SVG icons in admin screens via #65089, we need a way to register an icon which is available via wp_get_icon() but not available via REST API and not exposed in the Icon block.
The current consensus of the approach has been discussed here: https://github.com/WordPress/gutenberg/pull/79451#issuecomment-4797981729. In short, we propose to allow a new property public when registering an icon via wp_register_icon().
Here's a summary of the behavior:
| Registered with | Registry / wp_get_icon() | REST API / Icon block |
public omitted or true | yes | yes |
public: false | yes | no |
This Trac ticket is also tracking Core backport for the Gutenberg-side changes here: https://github.com/WordPress/gutenberg/pull/82634.
Change History (7)
This ticket was mentioned in PR #13453 on WordPress/wordpress-develop by @fushar.
4 weeks ago
#1
- Keywords has-patch has-unit-tests added
This ticket was mentioned in PR #13633 on WordPress/wordpress-develop by @wildworks.
2 weeks ago
#3
Moves icon visibility from the icon level to the collection level.
wp_register_icon_collection() now accepts a public property (default true), and the icons / icon collections REST controllers hide non-public collections and every icon in them. Those icons remain available to server-side code via wp_get_icon().
Backports https://github.com/WordPress/gutenberg/pull/83277 to core. See that PR for the rationale.
Use of AI Tools
AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Opus 5
Used for: Porting the Gutenberg implementation and tests to core; reviewed and edited by me.
#4
@
2 weeks ago
Reopening this ticket as the public property needs to be moved from the icon-level to the collection-level.
See https://github.com/WordPress/gutenberg/pull/83261#issuecomment-5758936393 for more details.
@wildworks commented on PR #13633:
2 weeks ago
#6
Closing: this has been folded into #13625, since the two changes cannot really be reviewed apart. The commit is preserved there.
#7
@
2 weeks ago
- Resolution → fixed
- Status reopened → closed
Reopening this ticket as the
publicproperty needs to be moved from the icon-level to the collection-level.
See https://github.com/WordPress/gutenberg/pull/83261#issuecomment-5758936393 for more details.
Since I have decided to address this issue in #66114, I am re-closing this ticket.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Trac ticket: https://core.trac.wordpress.org/ticket/66087.
Backport from https://github.com/WordPress/gutenberg/pull/82634.
## What
This PR allows an optional boolean
publicproperty to icon registration viawp_register_icon().Icons registered with
public: falsewill still be available throughwp_get_icon(), but the REST API will not return them, so they aren't exposed in the Icon block.As a back-compatibility, if we don't provide a
publicproperty, the default istrueand the behavior will be the same as the existing behavior.Here's a summary of the behavior:
wp_get_icon()publicomitted ortruepublic: false## Use of AI Tools
Used Claude Opus to generate the backported changes from the linked Gutenberg PR, then checked the changes myself.