Title: WP_Icons_Registry::__construct
Published: May 20, 2026

---

# WP_Icons_Registry::__construct()

## In this article

 * [Description](https://developer.wordpress.org/reference/classes/wp_icons_registry/__construct/?output_format=md#description)
 * [Source](https://developer.wordpress.org/reference/classes/wp_icons_registry/__construct/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/classes/wp_icons_registry/__construct/?output_format=md#related)

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

Constructor.

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

[WP_Icons_Registry](https://developer.wordpress.org/reference/classes/wp_icons_registry/)
is a singleton class, so keep this protected.

For 7.0, the Icons Registry is closed for third-party icon registry, serving only
a subset of core icons.

These icons are defined in @wordpress/packages (Gutenberg repository) as SVG files
and as entries in a single manifest file. On init, the registry is loaded with those
icons listed in the manifest.

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

    ```php
    protected function __construct() {
    	$icons_directory = __DIR__ . '/images/icon-library/';
    	$manifest_path   = __DIR__ . '/assets/icon-library-manifest.php';

    	if ( ! is_readable( $manifest_path ) ) {
    		wp_trigger_error(
    			__METHOD__,
    			__( 'Core icon collection manifest is missing or unreadable.' )
    		);
    		return;
    	}

    	$collection = include $manifest_path;

    	if ( empty( $collection ) ) {
    		wp_trigger_error(
    			__METHOD__,
    			__( 'Core icon collection manifest is empty or invalid.' )
    		);
    		return;
    	}

    	foreach ( $collection as $icon_name => $icon_data ) {
    		if (
    			empty( $icon_data['filePath'] )
    			|| ! is_string( $icon_data['filePath'] )
    		) {
    			_doing_it_wrong(
    				__METHOD__,
    				__( 'Core icon collection manifest must provide valid a "filePath" for each icon.' ),
    				'7.0.0'
    			);
    			return;
    		}

    		$this->register(
    			'core/' . $icon_name,
    			array(
    				'label'    => $icon_data['label'],
    				'filePath' => $icons_directory . $icon_data['filePath'],
    			)
    		);
    	}
    }
    ```

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

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

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

Registers an icon.

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

Generates a user-level error/warning/notice/deprecation message.

  | 
| [__()](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_icons_registry/__construct/?output_format=md#)
[Show less](https://developer.wordpress.org/reference/classes/wp_icons_registry/__construct/?output_format=md#)

| Used by | Description | 
| [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.

  |

## User Contributed Notes

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