[ 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: 500 lines (13 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

WP_Icons_Registry:: (11 methods):
  __construct()
  register()
  unregister()
  get_allowed_attribute_list()
  sanitize_icon_content()
  get_content()
  get_registered_icon()
  icon_matches_search()
  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.

Icons are populated via `_wp_register_default_icons()` during the
`init` action. Third-party icons can be registered via
{@see wp_register_icon()} once their collection is registered.


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

param: string $icon_name       Namespaced icon name in the form "collection/icon-name"
param: array  $icon_properties {
return: bool True if the icon was registered with success and false otherwise.

unregister( $icon_name )   X-Ref
Unregisters an icon.

param: string $icon_name Namespaced icon name in the form "collection/icon-name"
return: bool True if the icon was unregistered successfully, false otherwise.

get_allowed_attribute_list( ...$attribute_names )   X-Ref
Builds the allowed attribute list for wp_kses() from attribute names.

param: non-falsy-string ...$attribute_names Attribute names to allow.
return: array<non-falsy-string, true> Attribute names mapped to true.

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

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.

icon_matches_search( $icon, $search )   X-Ref
Determines whether an icon matches a search term.

The term is matched case-insensitively against the icon's name, its label,
and any of its keywords.

param: array  $icon   Registered icon properties.
param: string $search Search term.
return: bool True if the icon matches the search term, false otherwise.

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

param: string $search Optional. Search term matched against each icon's name,
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 : Tue Oct 13 08:20:33 2026 Cross-referenced by PHPXref