how to get category from url in wordpress

no comments
23 Dec 2016 2:19 am

I was development a section a in my #wordpress theme I need the current category from url, here is I figure out how to get category from url.

$page_position = strpos($_SERVER['REQUEST_URI'],'page');
    $CAT_URL = substr($_SERVER['REQUEST_URI'],0,$page_position);
} else {
$urlslugArray = array_filter(explode('/',$CAT_URL));

$get_the_category = get_category_by_slug(end($urlslugArray));
    $tagtut_title = $get_the_category->name;
    $tagtut_desc = $get_the_category->category_description;
    $posts_found = $get_the_category->count;

NOTE:Your Email Address will be not shown and please do not add spamming comments because here is REL="NOFOLLOW" on your links and comments also moderated shown.
<code>Put html css or any language code under this tag</code>