wpseek.com
A WordPress-centric search engine for devs and theme authors



_wp_register_default_icons › WordPress Function

Since7.1.0
Deprecatedn/a
_wp_register_default_icons ( No parameters )
Access:
  • private
Defined at:
Codex:

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'],
			)
		);
	}
}