Retrieves a specific icon from the registry.
Parameters
$namestringrequired- Icon name.
Source
public function get_icon( $name ) {
$registry = WP_Icons_Registry::get_instance();
$icon = $registry->get_registered_icon( $name );
if ( null === $icon ) {
return new WP_Error(
'rest_icon_not_found',
sprintf(
// translators: %s is the name of any user-provided name
__( 'Icon not found: "%s".' ),
$name
),
array( 'status' => 404 )
);
}
return $icon;
}
User Contributed Notes
You must log in before being able to contribute a note or feedback.