Make WordPress Core


Ignore:
Timestamp:
07/15/2026 04:25:35 AM (3 months ago)
Author:
wildworks
Message:

Icons: Add APIs for collection and icon registration

Introduces a set of public APIs for registering icon collections and individual icons, allowing themes and plugins to register icons for consistent use across the block editor and the wider WordPress admin.

  • Add the WP_Icon_Collections_Registry class, a singleton that manages the registration of icon collections. Each collection groups a set of icons under a namespace and is exposed through the REST API via the new WP_REST_Icon_Collections_Controller.
  • Update the WP_Icons_Registry class to allow registering custom icons through public register() and unregister() methods, surfaced through WP_REST_Icons_Controller.
  • Add four wrapper functions in icons.php: wp_register_icon_collection() and wp_unregister_icon_collection() for collections, and wp_register_icon() and wp_unregister_icon() for individual icons.
  • Register the default collections and icons through _wp_register_default_icon_collections() and _wp_register_default_icons(), both hooked to the init action.

Props mcsf, tyxla, wildworks.
See #64847.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/default-filters.php

    r62668 r62748  
    819819add_action( 'init', '_wp_register_default_font_collections' );
    820820
     821// Icons.
     822add_action( 'init', '_wp_register_default_icon_collections', 0 );
     823add_action( 'init', '_wp_register_default_icons' );
     824
    821825// Add ignoredHookedBlocks metadata attribute to the template and template part post types.
    822826add_filter( 'rest_pre_insert_wp_template', 'inject_ignored_hooked_blocks_metadata_attributes' );
Note: See TracChangeset for help on using the changeset viewer.