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

Defines 1 class

WP_Icons_Registry:: (13 methods):
  __construct()
  register()
  unregister()
  get_allowed_attribute_list()
  sanitize_icon_content()
  get_content()
  is_core_icon_file()
  get_registered_icon()
  icon_matches_search()
  get_registered_icons()
  is_registered()
  get_admin_icon_name_for_dashicon()
  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.

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

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

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

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

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

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

return: string The sanitized icon SVG content.
param: string $icon_content The icon SVG content to sanitize.

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

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

is_core_icon_file( $icon_path )   X-Ref
Determines whether an icon file is a core icon.

return: bool Whether the file is in the core icon library.
param: string $icon_path Icon file path, resolved with `realpath()`.

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

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

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.

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

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

return: array[] Array of arrays containing the registered icon properties.
param: string $search Optional. Search term matched against each icon's name,

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

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

get_admin_icon_name_for_dashicon( $dashicon )   X-Ref
Returns the name of the icon that replaces a Dashicon in the admin interface.

The replacements come from the `dashicons` property of the `core-admin`
icons in the icon library manifest.

return: string|null Namespaced name of the replacement icon, such as `core-admin/pin`,
param: string $dashicon Dashicon class name, such as `dashicons-admin-post`.

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 Nov 3 08:20:36 2026 Cross-referenced by PHPXref