One of the major advantages of WordPress that makes it the preferred content management system aka CMS for many web developers and web masters is that its high customizable, you can customize the look of the website through themes and you can customize the functionality of the wordpress website through plugins.
One of the ways by which you as a webmaster can customize your website and make it your own is to use icons for custom posts that would help you easily pick a category of articles and work on them; for example you can add a book icon for articles talking about a book review or you can add a movie icon for posts about a movie review and so on. This can be done either using a plugin, but we all know the drawbacks of plugins as they tend to increase page load times and server overhead. So this post will give you a step by step instructions on how to add icons to custom posts in WordPress without a plugin.
Step 1: First, you need to visit Dashicons website (https://developer.wordpress.org/resource/dashicons/#menu) where you will find a collection of icons that you can use in your website.
Step 2: In the website, click on the icon you want to use, and then copy the icon name as seen in the screenshot below.
Step 3: Now, within register_post_type function call and in “menu_icon” type the name you have copied in the step above as seen in the screenshot below (in line 11).
Step 4: Now, re-open the dashboard and you shall find this newly added icon in there.
Congratulations, you have successfully added an icon to your custom posts to easily identify them and make the website really your own.