Wordpress - get current category ID php
you can use get_queried_object()
$category = get_queried_object();
echo $category->term_id;
If you want to fecth in category page,you can get id of current category by:
$category = get_category( get_query_var( 'cat' ) );
$cat_id = $category->cat_ID;
If you want to get category id of any particular category on any page, you can try using below code:
$category_id = get_cat_ID('Category Name');