Title: WP_Icon_Collections_Registry::unregister
Published: August 20, 2026

---

# WP_Icon_Collections_Registry::unregister( string $collection_slug ): bool

## In this article

 * [Description](https://developer.wordpress.org/reference/classes/wp_icon_collections_registry/unregister/?output_format=md#description)
 * [Parameters](https://developer.wordpress.org/reference/classes/wp_icon_collections_registry/unregister/?output_format=md#parameters)
 * [Return](https://developer.wordpress.org/reference/classes/wp_icon_collections_registry/unregister/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/classes/wp_icon_collections_registry/unregister/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/classes/wp_icon_collections_registry/unregister/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/classes/wp_icon_collections_registry/unregister/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/classes/wp_icon_collections_registry/unregister/?output_format=md#wp--skip-link--target)

Unregisters an icon collection.

## 󠀁[Description](https://developer.wordpress.org/reference/classes/wp_icon_collections_registry/unregister/?output_format=md#description)󠁿

Any icons registered under the given collection are also unregistered.

## 󠀁[Parameters](https://developer.wordpress.org/reference/classes/wp_icon_collections_registry/unregister/?output_format=md#parameters)󠁿

 `$collection_slug`stringrequired

Icon collection slug.

## 󠀁[Return](https://developer.wordpress.org/reference/classes/wp_icon_collections_registry/unregister/?output_format=md#return)󠁿

 bool True if the collection was unregistered successfully, false otherwise.

## 󠀁[Source](https://developer.wordpress.org/reference/classes/wp_icon_collections_registry/unregister/?output_format=md#source)󠁿

    ```php
    public function unregister( $collection_slug ) {
    	if ( ! $this->is_registered( $collection_slug ) ) {
    		_doing_it_wrong(
    			__METHOD__,
    			sprintf(
    				/* translators: %s: Icon collection slug. */
    				__( 'Icon collection "%s" not found.' ),
    				$collection_slug
    			),
    			'7.1.0'
    		);
    		return false;
    	}

    	$icons_registry = WP_Icons_Registry::get_instance();
    	foreach ( $icons_registry->get_registered_icons() as $icon ) {
    		if ( isset( $icon['collection'] ) && $icon['collection'] === $collection_slug ) {
    			$icons_registry->unregister( $icon['name'] );
    		}
    	}

    	unset( $this->registered_collections[ $collection_slug ] );

    	return true;
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/class-wp-icon-collections-registry.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.1/src/wp-includes/class-wp-icon-collections-registry.php#L146)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.1/src/wp-includes/class-wp-icon-collections-registry.php#L146-L170)

## 󠀁[Related](https://developer.wordpress.org/reference/classes/wp_icon_collections_registry/unregister/?output_format=md#related)󠁿

| Uses | Description | 
| [WP_Icon_Collections_Registry::is_registered()](https://developer.wordpress.org/reference/classes/wp_icon_collections_registry/is_registered/)`wp-includes/class-wp-icon-collections-registry.php` |

Checks if an icon collection is registered.

  | 
| [WP_Icons_Registry::get_instance()](https://developer.wordpress.org/reference/classes/wp_icons_registry/get_instance/)`wp-includes/class-wp-icons-registry.php` |

Utility method to retrieve the main instance of the class.

  | 
| [__()](https://developer.wordpress.org/reference/functions/__/)`wp-includes/l10n.php` |

Retrieves the translation of $text.

  | 
| [_doing_it_wrong()](https://developer.wordpress.org/reference/functions/_doing_it_wrong/)`wp-includes/functions.php` |

Marks something as being incorrectly called.

  |

[Show 2 more](https://developer.wordpress.org/reference/classes/wp_icon_collections_registry/unregister/?output_format=md#)
[Show less](https://developer.wordpress.org/reference/classes/wp_icon_collections_registry/unregister/?output_format=md#)

## 󠀁[Changelog](https://developer.wordpress.org/reference/classes/wp_icon_collections_registry/unregister/?output_format=md#changelog)󠁿

| Version | Description | 
| [7.1.0](https://developer.wordpress.org/reference/since/7.1.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_icon_collections_registry%2Funregister%2F)
before being able to contribute a note or feedback.