Alisha Lamichhane
Alisha Lamichhane

Reputation: 514

Get an array of category details with category name in WordPress

I have an URL like this https://example.com/parent-category/child-category/

With the function single_cat_title() $category = single_cat_title('', false); I am getting the name of the active category. Now, how can I get the details of the category with the name I am getting in the $category variable?

Upvotes: 0

Views: 32

Answers (1)

Wordpress Dev
Wordpress Dev

Reputation: 301

<?php $queried_object = get_queried_object();
print_r( $queried_object ); ?>

Upvotes: 1

Related Questions