Display custom taxonomy on single post

Question

I have 4 different custom entries from my custom category.

Categories are: john-doe, jane-doe, john-does, jane-does

Each of the user have different posts. Let’s say John Doe have a post, but on that post, I wanted to display his name via the post, but how can I fetch his category name “John Doe” without using the tax_query?

For example:
John Doe have a post (same with his custom category name) and the url is, “www.domain.com/john-doe” he have a post here and the url is, “www.domain.com/portfolio/name-of-the-post. This post have all the contents except the category. So by that, How would I know if the post custom category was from John Doe without declaring or using the code below?

I tried get_the_category(), get_category() but throws error.

PS.
I use this code and it was working fine to display all posts under their names manually.

$my_query = new WP_Query( array( 'post_type'=>'news', 'posts_per_page'=>4, 'tax_query'=>array( array( 'taxonomy'=>'portfolio_users', 'field'=>'slug', 'terms'=>'john-doe' // change to real slug ) ) ) ); while ($my_query->have_posts() ) {
\$my_query->the_post();
// display post
}

0
4 years 2017-12-03T11:12:25-05:00 0 Answers 68 views 0