Getting key value of WP_Term object in wordpress
It returns an array because Posts can have multiple categories. You just need to get the item from the array whose name you want, ($queried_object[0] for the first one), then get the value out of that the same way you would any PHP object: $name = $queried_object[0]->name; You should probably include some checks to make … Read more