wp_unregister_icon()WP 7.1.0

Removes a registered SVG icon from the registry.

Call this function after registering the icon with wp_register_icon(). It is usually hooked to init at a late priority.

To remove all icons in a collection, use wp_unregister_icon_collection().

After removal, existing blocks that use this icon will no longer be able to display it.

No Hooks.

Returns

bool.

  • true - the icon was successfully removed from the registry.
  • false - no icon with the specified name is registered. An _doing_it_wrong() notice is also generated.

Usage

wp_unregister_icon( $icon_name );
$icon_name(string) (required)
Icon name in the collection/name format, for example my-plugin/star.

Examples

#1 Removing a registered icon

add_action( 'init', 'my_plugin_unregister_icon', 99 );

function my_plugin_unregister_icon() {
	wp_unregister_icon( 'my-plugin/star' );
}

Changelog

Since 7.1.0 Introduced.

wp_unregister_icon() code WP 7.1

function wp_unregister_icon( $icon_name ) {
	return WP_Icons_Registry::get_instance()->unregister( $icon_name );
}