_wp_register_default_icons()

In this article

This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only by core. It is listed here for completeness.

Registers the default core icons from the manifest.

Source

function _wp_register_default_icons() {
	$icons_directory = ABSPATH . WPINC . '/images/icon-library/';
	$manifest_path   = ABSPATH . WPINC . '/assets/icon-library-manifest.php';

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

	$collection = include $manifest_path;

	if ( empty( $collection ) ) {
		wp_trigger_error(
			__FUNCTION__,
			__( '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(
				__FUNCTION__,
				__( 'Core icon collection manifest must provide a valid "filePath" for each icon.' ),
				'7.0.0'
			);
			return;
		}

		wp_register_icon(
			'core/' . $icon_name,
			array(
				'label'     => $icon_data['label'],
				'file_path' => $icons_directory . $icon_data['filePath'],
			)
		);
	}
}

Changelog

VersionDescription
7.1.0Introduced.

User Contributed Notes

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