[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

/wp-includes/ -> class-wp-icons-registry.php (summary)

Icons API: WP_Icons_Registry class

File Size: 324 lines (8 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

WP_Icons_Registry:: (8 methods):
  __construct()
  register()
  sanitize_icon_content()
  get_content()
  get_registered_icon()
  get_registered_icons()
  is_registered()
  get_instance()


Class: WP_Icons_Registry  - X-Ref

Core class used for interacting with registered icons.

__construct()   X-Ref
Constructor.

WP_Icons_Registry is a singleton class, so keep this protected.

For 7.0, the Icons Registry is closed for third-party icon registry,
serving only a subset of core icons.

These icons are defined in @wordpress/packages (Gutenberg repository) as
SVG files and as entries in a single manifest file. On init, the
registry is loaded with those icons listed in the manifest.


register( $icon_name, $icon_properties )   X-Ref
Registers an icon.

param: string $icon_name       Icon name including namespace.
param: array  $icon_properties {
return: bool True if the icon was registered with success and false otherwise.

sanitize_icon_content( $icon_content )   X-Ref
Sanitizes the icon SVG content.

Logic borrowed from twentytwenty.
param: string $icon_content The icon SVG content to sanitize.
return: string The sanitized icon SVG content.

get_content( $icon_name )   X-Ref
Retrieves the content of a registered icon.

param: string $icon_name Icon name including namespace.
return: string|null The content of the icon, if found.

get_registered_icon( $icon_name )   X-Ref
Retrieves an array containing the properties of a registered icon.

param: string $icon_name Icon name including namespace.
return: array|null Registered icon properties or `null` if the icon is not registered.

get_registered_icons( $search = '' )   X-Ref
Retrieves all registered icons.

param: string $search Optional. Search term by which to filter the icons.
return: array[] Array of arrays containing the registered icon properties.

is_registered( $icon_name )   X-Ref
Checks if an icon is registered.

param: string $icon_name Icon name including namespace.
return: bool True if the icon is registered, false otherwise.

get_instance()   X-Ref
Utility method to retrieve the main instance of the class.

The instance will be created if it does not exist yet.

return: WP_Icons_Registry The main instance.



Generated : Sun Jun 14 08:20:09 2026 Cross-referenced by PHPXref