By default WordPress having an function called get_cat_ID() to retrieve get category ID from category name. Please check the below sample code for how to get category ID from category name in WordPress. Replace ‘Category Name’ with your category name.
$categoryID = get_cat_ID('Category Name');
If you have any doubt, Please comment here.