Define an icon

Dashiconsarrow-up-right is an icon font you can use with your post types.

To set the post type icon pass the dashicon icon slug in the icon() method.

use PostTypes\PostType;

class Books extends PostType
{
    //...

    /**
     * Returns the admin menu icon for the Books post type.
     *
     * @return string
     */
    public function icon(): string
    {
        return 'dashicons-book-alt';
    }
}

A list of available icons can be found on the WordPress documentationarrow-up-right

Last updated