wp_register_icon( string $icon_name, array $args ): bool

In this article

Registers a new icon.

Parameters

$icon_namestringrequired
Namespaced icon name in the form "collection/icon-name" (e.g. "my-plugin/arrow-left"). The "core" collection is reserved for WordPress core icons; third-party code should register icons under its own collection rather than the "core" collection.
$argsarrayrequired
List of properties for the icon.
  • label string
    Required. A human-readable label for the icon.
  • content string
    Optional. SVG markup for the icon.
    If not provided, the content will be retrieved from the file_path if set.
    If both content and file_path are not set, the icon will not be registered.
  • file_path string
    Optional. The full path to the file containing the icon content.

Return

bool True if the icon was registered successfully, else false.

Source

function wp_register_icon( $icon_name, $args ) {
	return WP_Icons_Registry::get_instance()->register( $icon_name, $args );
}

Changelog

VersionDescription
7.1.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.