wp-includes/class-wp-icons-registry.php:63Registers an icon.
$icon_namestring$icon_propertiesarray$labelstring
$contentstring
$file_pathstring
bool public function register( $icon_name, $icon_properties ) { if ( ! isset( $icon_name ) || ! is_string( $icon_name ) ) { _doing_it_wrong( __METHOD__, __( 'Icon name must be a string.' ), '7.0.0' ); return false; } // Require a namespaced name in the form "collection/icon-name". if ( ! str_contains( $icon_name, '/' ) ) { _doing_it_wrong( __METHOD__, __( 'Icon name must be namespaced in the form "collection/icon-name".' ), '7.1.0' ); return false; } // Split the namespaced name into a collection slug and an unqualified icon name. list( $collection, $unqualified_name ) = explode( '/', $icon_name, 2 ); if ( preg_match( '/[A-Z]/', $unqualified_name ) ) { _doing_it_wrong( __METHOD__, __( 'Icon names must not contain uppercase characters.' ), '7.1.0' ); return false; } if ( ! preg_match( '/^[a-z0-9](?:[a-z0-9_-]*[a-z0-9])?$/', $unqualified_name ) ) { _doing_it_wrong( __METHOD__, __( 'Icon names must start and end with a lowercase letter or digit and contain only lowercase letters, digits, hyphens, and underscores.' ), '7.1.0' ); return false; } $allowed_keys = array_fill_keys( array( 'label', 'content', 'file_path' ), 1 ); foreach ( array_keys( $icon_properties ) as $key ) { if ( ! array_key_exists( $key, $allowed_keys ) ) { _doing_it_wrong( __METHOD__, sprintf( /* translators: %s: The name of a user-provided key. */ __( 'Invalid icon property: "%s".' ), $key ), '7.0.0' ); return false; } } if ( ! WP_Icon_Collections_Registry::get_instance()->is_registered( $collection ) ) { _doing_it_wrong( __METHOD__, sprintf( /* translators: %s: Icon collection slug. */ __( 'Icon collection "%s" is not registered.' ), $collection ), '7.1.0' ); return false; } if ( ! isset( $icon_properties['label'] ) || ! is_string( $icon_properties['label'] ) ) { _doing_it_wrong( __METHOD__, __( 'Icon label must be a string.' ), '7.0.0' ); return false; } if (Introduced in 7.0.0. Unchanged from 7.0.4 through 7.1.0.
Signature, return type and hooks compared across 2 parsed releases.
src/wp-includes/class-wp-icons-registry.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.